trailer.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <view class="page">
  3. <view class="address p-4 mb-4">
  4. <view class="mb-3" @click="stopMap">
  5. <view class="title dis a-c">
  6. <view class="round"></view>
  7. <text>起点</text>
  8. </view>
  9. <view class="dis j-s a-start ">
  10. <text style="width: 80%;color: #000;">{{dataInfo.rescueStarting}}</text>
  11. <u-icon name="arrow-right" color="#b0afb7" size="30" style="margin-top: 5px;"></u-icon>
  12. </view>
  13. </view>
  14. <view class="mb-3" @click="stopMap1">
  15. <view class="title dis a-c">
  16. <view class="round" style="background-color: #19d8ac;"></view>
  17. <text>终点</text>
  18. </view>
  19. <view class="dis j-s a-start ">
  20. <text style="width: 80%;color: #000;">{{dataInfo.rescuePosition}}</text>
  21. <u-icon name="arrow-right" color="#b0afb7" size="30" style="margin-top: 5px;"></u-icon>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="address p-4 mb-4">
  26. <text class="title">填写详细信息</text>
  27. <view class="mt-2 dis j-s a-c">
  28. <text style="width: 30%;">救援场景</text>
  29. <view class="dis a-c j-s" style="width: 70%;">
  30. <view class="status-data dis a-c j-c" :class="item.label==dataInfo.rescueScene? 'active':''"
  31. v-for="(item,index) in sceneList" :key="index" @tap="sceneclick(item.label)"> {{item.label}}
  32. </view>
  33. </view>
  34. </view>
  35. <view class="mt-2 dis j-s a-c">
  36. <text style="width: 35%;">车牌号</text>
  37. <u-input style="width: 40%;" v-model="dataInfo.licencePlate" type="text" placeholder="请输入车牌号" />
  38. <u-icon name="arrow-right" color="#b0afb7" size="30"></u-icon>
  39. </view>
  40. <view class="mt-2 dis j-s a-c">
  41. <text style="width: 35%;">救援联系人</text>
  42. <u-input style="width: 40%;" v-model="dataInfo.rescueUser" type="text" placeholder="请输入联系人姓名" />
  43. </view>
  44. <view class="mt-2 dis j-s a-c">
  45. <text style="width: 35%;">联系人手机号</text>
  46. <u-input style="width: 40%;" v-model="dataInfo.phoneNumber" type="text" placeholder="请输入联系人手机号" />
  47. </view>
  48. </view>
  49. <view class="footerFixed dis j-s a-end">
  50. <view class="price">
  51. <text>¥</text>
  52. <text>{{dataInfo.rescueSum}}</text>
  53. <text>.00</text>
  54. </view>
  55. <view class="order dis a-c j-c" @click="plaorder">
  56. <text>立即购买</text>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. data() {
  64. return {
  65. dataInfo: {
  66. rescueStarting: null, //救援起点
  67. startingLatitude: "", //起点纬度
  68. startingLongitude: "", //起点经度
  69. rescuePosition: null, //救援终点
  70. positionLatitude: "", //终点纬度
  71. positionLongitude: "", //终点经度
  72. rescueScene: "地面", //救援场景
  73. licencePlate: "", //车牌号
  74. rescueUser: "", //联系人
  75. phoneNumber: "", //电话
  76. serveCode: "202", //服务类型
  77. rescueSum: "168", //救援金额
  78. },
  79. sceneList: [{
  80. label: "地面"
  81. },
  82. {
  83. label: "地下一层"
  84. },
  85. {
  86. label: "地下多层"
  87. }
  88. ]
  89. }
  90. },
  91. onShow() {
  92. if (!this.dataInfo.rescueStarting) {
  93. this.getCurrentLocation();
  94. }
  95. },
  96. onLoad() {},
  97. methods: {
  98. getCurrentLocation() {
  99. //获取当前的地理位置
  100. let vthis = this;
  101. uni.getLocation({
  102. type: 'gcj02',
  103. geocode: true,
  104. success: function(res) {
  105. let address = res.address.province + res.address.city + res.address.district + res
  106. .address.street + res.address.poiName;
  107. vthis.startingLatitude = res.latitude;
  108. vthis.startingLongitude = res.longitude;
  109. vthis.dataInfo.rescueStarting = address;
  110. },
  111. fail: function(err) {
  112. // #ifdef APP-PLUS
  113. uni.showModal({
  114. title: '提示',
  115. content: '请打开定位服务',
  116. success: ({
  117. confirm,
  118. cancel
  119. }) => {
  120. if (confirm) {
  121. // android平台
  122. if (uni.getSystemInfoSync().platform == 'android') {
  123. var Intent = plus.android.importClass(
  124. 'android.content.Intent');
  125. var Settings = plus.android.importClass(
  126. 'android.provider.Settings');
  127. var intent = new Intent(Settings
  128. .ACTION_LOCATION_SOURCE_SETTINGS);
  129. var main = plus.android.runtimeMainActivity();
  130. main.startActivity(intent); // 打开系统设置GPS服务页面
  131. }
  132. }
  133. // 用户取消前往开启定位服务
  134. if (cancel) {
  135. uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
  136. delta: 1
  137. });
  138. }
  139. }
  140. });
  141. // #endif
  142. }
  143. });
  144. },
  145. stopMap() {
  146. uni.navigateTo({
  147. url: "/pages/roadRescue/map?type=1"
  148. })
  149. },
  150. stopMap1() {
  151. uni.navigateTo({
  152. url: "/pages/roadRescue/map?type=2"
  153. })
  154. },
  155. async plaorder() {
  156. let res = await this.$http.post('/ser/rescue/insert/rescueOrder', this.dataInfo);
  157. if (res.code == '200') {
  158. uni.showToast({
  159. title: '下单成功',
  160. duration: 2000,
  161. icon: "success"
  162. });
  163. }
  164. },
  165. sceneclick(e) {
  166. this.dataInfo.rescueScene = e;
  167. },
  168. }
  169. }
  170. </script>
  171. <style lang="scss" scoped>
  172. .page {
  173. height: 100%;
  174. background-color: #f5f6f8;
  175. padding: 20px;
  176. }
  177. .address {
  178. background-color: white;
  179. .title {
  180. font-size: 18px;
  181. font-weight: bold;
  182. text {
  183. margin-left: 8px;
  184. }
  185. .round {
  186. width: 8px;
  187. height: 8px;
  188. background-color: #3466ed;
  189. border-radius: 50%;
  190. }
  191. }
  192. }
  193. .footerFixed {
  194. position: fixed;
  195. bottom: 0;
  196. left: 0;
  197. right: 0;
  198. width: 100%;
  199. height: 60px;
  200. background-color: white;
  201. padding-left: 20px;
  202. view:first-child {
  203. width: 65%;
  204. }
  205. .price {
  206. color: #3267eb;
  207. font-weight: bold;
  208. font-size: 18px;
  209. }
  210. text:nth-child(2) {
  211. font-size: 34px;
  212. line-height: 1.2;
  213. }
  214. .order {
  215. width: 35%;
  216. height: 100%;
  217. background-color: #3267eb;
  218. color: #f5f6f8;
  219. font-size: 18px;
  220. }
  221. }
  222. .status-data {
  223. width: 140rpx;
  224. padding: 2px 10px;
  225. box-sizing: border-box;
  226. font-size: 12px;
  227. border: 1px solid #9b99a7;
  228. border-radius: 5px;
  229. cursor: pointer;
  230. color: #9d9ba6;
  231. }
  232. .active {
  233. background: #e0fef4;
  234. color: #11c391;
  235. border: 1px solid #e0fef4;
  236. border: none;
  237. }
  238. </style>