replacement.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="page">
  3. <service-widget @btnClick="btn_click"></service-widget>
  4. <view class="address p-3 mb-4" @click="stopMap">
  5. <view class="title">
  6. <u-icon name="map" color="#2c2a35" size="38"></u-icon>
  7. <text>救援位置</text>
  8. </view>
  9. <view class="dis j-s a-start mt-2">
  10. <text style="width: 80%;color: #000;">{{dataInfo.rescuePosition}}</text>
  11. <u-icon name="arrow-right" color="#b0afb7" size="30" style="margin-top: 5px;"></u-icon>
  12. </view>
  13. </view>
  14. <view class="address p-3 mb-4">
  15. <text class="title">填写详细信息</text>
  16. <view class="mt-2 dis j-s a-c">
  17. <text style="width: 35%;">车牌号</text>
  18. <u-input style="width: 40%;" v-model="dataInfo.licencePlate" type="text" placeholder="请输入车牌号" />
  19. <u-icon name="arrow-right" color="#b0afb7" size="30"></u-icon>
  20. </view>
  21. <view class="mt-2 dis j-s a-c">
  22. <text style="width: 35%;">救援联系人</text>
  23. <u-input style="width: 40%;" v-model="dataInfo.rescueUser" type="text" placeholder="请输入联系人姓名" />
  24. </view>
  25. <view class="mt-2 dis j-s a-c">
  26. <text style="width: 35%;">联系人手机号</text>
  27. <u-input style="width: 40%;" v-model="dataInfo.phoneNumber" type="text" placeholder="请输入联系人手机号" />
  28. </view>
  29. </view>
  30. <view class="footerFixed dis j-s a-end">
  31. <view class="price">
  32. <text>¥</text>
  33. <text>{{dataInfo.rescueSum}}</text>
  34. <text>.00</text>
  35. </view>
  36. <view class="order dis a-c j-c" @click="plaorder">
  37. <text>立即购买</text>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. data() {
  45. return {
  46. dataInfo: {
  47. rescuePosition: null, //救援地址
  48. rescueSum: "168", //救援金额
  49. licencePlate: "", //车牌号
  50. rescueUser: "", //联系人
  51. phoneNumber: "", //电话
  52. serveCode: "203",
  53. }
  54. }
  55. },
  56. onShow() {
  57. if (!this.dataInfo.rescuePosition) {
  58. this.getCurrentLocation();
  59. }
  60. },
  61. onLoad() {},
  62. methods: {
  63. btn_click() {
  64. uni.navigateTo({
  65. url: '/pages/chat/chat'
  66. })
  67. },
  68. getCurrentLocation() {
  69. //获取当前的地理位置
  70. let vthis = this;
  71. uni.getLocation({
  72. type: 'gcj02',
  73. geocode: true,
  74. success: function(res) {
  75. let address = res.address.province + res.address.city + res.address.district + res
  76. .address.street + res.address.poiName;
  77. vthis.dataInfo.rescuePosition = address;
  78. },
  79. fail: function(err) {
  80. // #ifdef APP-PLUS
  81. uni.showModal({
  82. title: '提示',
  83. content: '请打开定位服务',
  84. success: ({
  85. confirm,
  86. cancel
  87. }) => {
  88. if (confirm) {
  89. // android平台
  90. if (uni.getSystemInfoSync().platform == 'android') {
  91. var Intent = plus.android.importClass(
  92. 'android.content.Intent');
  93. var Settings = plus.android.importClass(
  94. 'android.provider.Settings');
  95. var intent = new Intent(Settings
  96. .ACTION_LOCATION_SOURCE_SETTINGS);
  97. var main = plus.android.runtimeMainActivity();
  98. main.startActivity(intent); // 打开系统设置GPS服务页面
  99. }
  100. }
  101. // 用户取消前往开启定位服务
  102. if (cancel) {
  103. uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
  104. delta: 1
  105. });
  106. }
  107. }
  108. });
  109. // #endif
  110. }
  111. });
  112. },
  113. stopMap() {
  114. uni.navigateTo({
  115. url: "/pages/roadRescue/map"
  116. })
  117. },
  118. async plaorder() {
  119. let res = await this.$http.post('/ser/rescue/insert/rescueOrder', this.dataInfo);
  120. if (res.code == '200') {
  121. uni.showToast({
  122. title: '下单成功',
  123. duration: 2000,
  124. icon: "success"
  125. });
  126. }
  127. },
  128. }
  129. }
  130. </script>
  131. <style lang="scss" scoped>
  132. .page {
  133. height: 100%;
  134. background-color: #f5f6f8;
  135. padding: 20px;
  136. }
  137. .address {
  138. background-color: white;
  139. .title {
  140. font-size: 18px;
  141. font-weight: bold;
  142. text {
  143. margin-left: 8px;
  144. }
  145. }
  146. }
  147. .footerFixed {
  148. position: fixed;
  149. bottom: 0;
  150. left: 0;
  151. right: 0;
  152. width: 100%;
  153. height: 60px;
  154. background-color: white;
  155. padding-left: 20px;
  156. view:first-child {
  157. width: 65%;
  158. }
  159. .price {
  160. color: #3267eb;
  161. font-weight: bold;
  162. font-size: 18px;
  163. }
  164. text:nth-child(2) {
  165. font-size: 34px;
  166. line-height: 1.2;
  167. }
  168. .order {
  169. width: 35%;
  170. height: 100%;
  171. background-color: #3267eb;
  172. color: #f5f6f8;
  173. font-size: 18px;
  174. }
  175. }
  176. </style>