trailer.vue 6.2 KB

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