replacement.vue 4.2 KB

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