Grounding.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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: "", //救援地址
  47. rescueSum: "168", //救援金额
  48. licencePlate: "", //车牌号
  49. rescueUser: "", //联系人
  50. phoneNumber: "", //电话
  51. serveCode: "201",
  52. }
  53. }
  54. },
  55. onShow() {
  56. this.getCurrentLocation();
  57. },
  58. onLoad() {},
  59. methods: {
  60. getCurrentLocation() {
  61. //获取当前的地理位置
  62. let vthis = this;
  63. uni.getLocation({
  64. type: 'gcj02',
  65. geocode: true,
  66. success: function(res) {
  67. console.log(res);
  68. let address = res.address.province + res.address.city + res.address.district + res
  69. .address.street + res.address.poiName;
  70. vthis.dataInfo.rescuePosition = address;
  71. },
  72. fail: function(err) {
  73. console.log(err);
  74. // uni.showModal({
  75. // title: '提示',
  76. // content: '请打开定位服务',
  77. // success: ({
  78. // confirm,
  79. // cancel
  80. // }) => {
  81. // if (confirm) {
  82. // // android平台
  83. // if (uni.getSystemInfoSync().platform == 'android') {
  84. // var Intent = plus.android.importClass(
  85. // 'android.content.Intent');
  86. // var Settings = plus.android.importClass(
  87. // 'android.provider.Settings');
  88. // var intent = new Intent(Settings
  89. // .ACTION_LOCATION_SOURCE_SETTINGS);
  90. // var main = plus.android.runtimeMainActivity();
  91. // main.startActivity(intent); // 打开系统设置GPS服务页面
  92. // }
  93. // }
  94. // // 用户取消前往开启定位服务
  95. // if (cancel) {
  96. // uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
  97. // delta: 1
  98. // });
  99. // }
  100. // }
  101. // });
  102. }
  103. });
  104. },
  105. stopMap() {
  106. uni.navigateTo({
  107. url: "/pages/roadRescue/map"
  108. })
  109. },
  110. async plaorder() {
  111. let res = await this.$http.post('/ser/rescue/insert/rescueOrder', this.dataInfo);
  112. if (res.code == '200') {
  113. uni.showToast({
  114. title: '下单成功',
  115. duration: 2000,
  116. icon: "success"
  117. });
  118. }
  119. },
  120. }
  121. }
  122. </script>
  123. <style lang="scss" scoped>
  124. .page {
  125. height: 100%;
  126. background-color: #f5f6f8;
  127. padding: 20px;
  128. }
  129. .address {
  130. background-color: white;
  131. .title {
  132. font-size: 18px;
  133. font-weight: bold;
  134. text {
  135. margin-left: 8px;
  136. }
  137. }
  138. }
  139. .footerFixed {
  140. position: fixed;
  141. bottom: 0;
  142. left: 0;
  143. right: 0;
  144. width: 100%;
  145. height: 60px;
  146. background-color: white;
  147. padding-left: 20px;
  148. view:first-child {
  149. width: 65%;
  150. }
  151. .price {
  152. color: #3267eb;
  153. font-weight: bold;
  154. font-size: 18px;
  155. }
  156. text:nth-child(2) {
  157. font-size: 34px;
  158. line-height: 1.2;
  159. }
  160. .order {
  161. width: 35%;
  162. height: 100%;
  163. background-color: #3267eb;
  164. color: #f5f6f8;
  165. font-size: 18px;
  166. }
  167. }
  168. </style>