replacement.vue 4.2 KB

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