trailer.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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: "", //救援起点
  67. startingLatitude: "", //起点纬度
  68. startingLongitude: "", //起点经度
  69. rescuePosition: "", //救援终点
  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. this.getCurrentLocation();
  93. },
  94. onLoad() {},
  95. methods: {
  96. getCurrentLocation() {
  97. //获取当前的地理位置
  98. let vthis = this;
  99. uni.getLocation({
  100. type: 'gcj02',
  101. geocode: true,
  102. success: function(res) {
  103. let address = res.address.province + res.address.city + res.address.district + res
  104. .address.street + res.address.poiName;
  105. vthis.startingLatitude = res.latitude;
  106. vthis.startingLongitude = res.longitude;
  107. vthis.dataInfo.rescueStarting = address;
  108. },
  109. fail: function(err) {
  110. uni.showModal({
  111. title: '提示',
  112. content: '请打开定位服务',
  113. success: ({
  114. confirm,
  115. cancel
  116. }) => {
  117. if (confirm) {
  118. // android平台
  119. if (uni.getSystemInfoSync().platform == 'android') {
  120. var Intent = plus.android.importClass(
  121. 'android.content.Intent');
  122. var Settings = plus.android.importClass(
  123. 'android.provider.Settings');
  124. var intent = new Intent(Settings
  125. .ACTION_LOCATION_SOURCE_SETTINGS);
  126. var main = plus.android.runtimeMainActivity();
  127. main.startActivity(intent); // 打开系统设置GPS服务页面
  128. }
  129. }
  130. // 用户取消前往开启定位服务
  131. if (cancel) {
  132. uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
  133. delta: 1
  134. });
  135. }
  136. }
  137. });
  138. }
  139. });
  140. },
  141. stopMap() {
  142. uni.navigateTo({
  143. url: "/pages/roadRescue/map?type=1"
  144. })
  145. },
  146. stopMap1() {
  147. uni.navigateTo({
  148. url: "/pages/roadRescue/map?type=2"
  149. })
  150. },
  151. async plaorder() {
  152. let res = await this.$http.post('/ser/rescue/insert/rescueOrder', this.dataInfo);
  153. if (res.code == '200') {
  154. uni.showToast({
  155. title: '下单成功',
  156. duration: 2000,
  157. icon: "success"
  158. });
  159. }
  160. },
  161. sceneclick(e) {
  162. this.dataInfo.rescueScene = e;
  163. },
  164. }
  165. }
  166. </script>
  167. <style lang="scss" scoped>
  168. .page {
  169. height: 100%;
  170. background-color: #f5f6f8;
  171. padding: 20px;
  172. }
  173. .address {
  174. background-color: white;
  175. .title {
  176. font-size: 18px;
  177. font-weight: bold;
  178. text {
  179. margin-left: 8px;
  180. }
  181. .round {
  182. width: 8px;
  183. height: 8px;
  184. background-color: #3466ed;
  185. border-radius: 50%;
  186. }
  187. }
  188. }
  189. .footerFixed {
  190. position: fixed;
  191. bottom: 0;
  192. left: 0;
  193. right: 0;
  194. width: 100%;
  195. height: 60px;
  196. background-color: white;
  197. padding-left: 20px;
  198. view:first-child {
  199. width: 65%;
  200. }
  201. .price {
  202. color: #3267eb;
  203. font-weight: bold;
  204. font-size: 18px;
  205. }
  206. text:nth-child(2) {
  207. font-size: 34px;
  208. line-height: 1.2;
  209. }
  210. .order {
  211. width: 35%;
  212. height: 100%;
  213. background-color: #3267eb;
  214. color: #f5f6f8;
  215. font-size: 18px;
  216. }
  217. }
  218. .status-data {
  219. width: 140rpx;
  220. padding: 2px 10px;
  221. box-sizing: border-box;
  222. font-size: 12px;
  223. border: 1px solid #9b99a7;
  224. border-radius: 5px;
  225. cursor: pointer;
  226. color: #9d9ba6;
  227. }
  228. .active {
  229. background: #e0fef4;
  230. color: #11c391;
  231. border: 1px solid #e0fef4;
  232. border: none;
  233. }
  234. </style>