confirm-order.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <view class="bt">
  3. <view class="flex plr-36 ptb-20">
  4. <view class="bold">
  5. {{type==1?'小面':type==2?'中面':type==3?'依维柯':type==4?'中货':type==5?'5米2':'6米8'}}
  6. </view>
  7. <view class="img-header">
  8. <image :src="img" mode="aspectFill"></image>
  9. </view>
  10. </view>
  11. <view class="" style="height: 20rpx;background: #F8F8F8;"></view>
  12. <view class="plr-36 ptb-30">
  13. <view class="flex1 flex-middle">
  14. <view class="">
  15. <view class="bg-green" style="width: 16rpx;height: 16rpx;border-radius: 50%;"></view>
  16. </view>
  17. <view class="ml-20">
  18. {{start.name}}
  19. </view>
  20. </view>
  21. <view class="flex1 flex-middle mt-30" v-for="(item,i) in hyaddress" :key="i">
  22. <view class="">
  23. <view class="bg-orange" style="width: 16rpx;height: 16rpx;border-radius: 50%;"></view>
  24. </view>
  25. <view class="ml-20 u-flex-1 flex">
  26. <view class="">
  27. {{item.address.name}}
  28. </view>
  29. <view class="">
  30. {{item.floor}}
  31. </view>
  32. </view>
  33. </view>
  34. <!-- <view class="mt-30 flex">
  35. <view class="flex1 flex-middle">
  36. <view class="">
  37. 搬运服务
  38. </view>
  39. <view class="ml-10" @click="show=true">
  40. <u-icon name="question-circle" color="#999"></u-icon>
  41. </view>
  42. </view>
  43. <view class="">
  44. <u-switch v-model="checked" size="30"></u-switch>
  45. </view>
  46. </view> -->
  47. </view>
  48. <view class="" style="height: 20rpx;background: #F8F8F8;"></view>
  49. <view class="">
  50. <view class="active" @click="show=true">
  51. <u-cell-item title="用车时间" :value="time=='预约'?'现在用车':time"></u-cell-item>
  52. </view>
  53. <view class="active">
  54. <u-cell-item title="联系电话" :value="userInfo.mobile" :arrow="false"></u-cell-item>
  55. </view>
  56. <view :class="[num=='请选择跟车人数'?'':'active']">
  57. <u-cell-item title="跟车人数(必填)" :value="num" @click="show1=true"></u-cell-item>
  58. </view>
  59. </view>
  60. <view class="" style="height: 20rpx;background: #F8F8F8;"></view>
  61. <view class="">
  62. <view :class="[demand?'active':'']">
  63. <u-cell-item title="额外需求" :value="demand_name" @click="goDemand"></u-cell-item>
  64. </view>
  65. <view :class="[remark=='如货物类别等'?'':'active','remark']">
  66. <u-cell-item title="订单备注" :value="remark" @click="goRemark"></u-cell-item>
  67. </view>
  68. </view>
  69. <view class="" style="height: 20rpx;background: #F8F8F8;"></view>
  70. <view class="active">
  71. <u-cell-item title="支付方式" :value="pay" @click="show2=true"></u-cell-item>
  72. <u-cell-item title="优惠券" class="red" :value="coupon_title" @click="goCoupon" v-if="iscoupon"></u-cell-item>
  73. </view>
  74. <view class="plr-36 pt-30" style="background: #F8F8F8;padding-bottom: 420rpx;">
  75. <view class="flex1 flex-middle">
  76. <u-radio-group v-model="value" active-color="#00C28E" @change="radioGroupChange">
  77. <u-radio name="1" ch :label-disabled="false"></u-radio>
  78. </u-radio-group>
  79. <view class="">
  80. 我已阅读并同意
  81. <text class="green" @click="goDetails(18,'货物托运居间服务协议')">《货物托运居间服务协议》</text>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="fixed-bottom">
  86. <view class="size-26 center plr-36" style="height: 60rpx;background: rgba(0,194,142,.3);">
  87. <view class="green">
  88. 若产生高速费、停车费和搬运费,请用户额外支付
  89. </view>
  90. <view class="img-warning">
  91. <image src="../../static/my-icon-6.png" mode=""></image>
  92. </view>
  93. </view>
  94. <view class="bg-white">
  95. <view class="center ptb-35">
  96. <text class="red size-26 bold">¥</text>
  97. <text class="red size-40 bold">{{money}}</text>
  98. <text class="ml-10" @click="goChagre">费用标准</text>
  99. </view>
  100. <view class="mlr-36 pb-35">
  101. <u-button type="primary" @click="submit">确认叫车</u-button>
  102. </view>
  103. </view>
  104. </view>
  105. <!-- 时间 -->
  106. <u-popup v-model="show" mode="bottom" height="400" @close="show=false">
  107. <longDate type="day" :openStatus="true" :getDayNum="3" :chooesMaxDay="3" @select="onSelectTime">
  108. </longDate>
  109. </u-popup>
  110. <!-- 跟车人数 -->
  111. <u-select v-model="show1" :list="list" @confirm="confirm"></u-select>
  112. <!-- 支付方式 -->
  113. <u-select v-model="show2" :list="list1" @confirm="confirm1"></u-select>
  114. </view>
  115. </template>
  116. <script>
  117. import {
  118. mapState
  119. } from 'vuex'
  120. import longDate from '../../components/long-date/long-date.vue'
  121. import NP from 'number-precision'
  122. export default {
  123. data() {
  124. return {
  125. coupon_id: '',
  126. type: 0,
  127. money: 0,
  128. time: '',
  129. img: '',
  130. checked: false,
  131. num: '请选择跟车人数',
  132. demand: '',
  133. demand_name: '是否需要搬运、返程等服务',
  134. remark: '如货物类别等',
  135. pay: '在线支付', //支付方式
  136. coupon: {},
  137. iscoupon: true, //是否显示优惠券
  138. show: false,
  139. show1: false,
  140. value: '1',
  141. list: [{
  142. value: '1',
  143. label: '0人'
  144. },
  145. {
  146. value: '2',
  147. label: '1人'
  148. },
  149. {
  150. value: '3',
  151. label: '2人'
  152. }
  153. ],
  154. show2: false,
  155. list1: [{
  156. value: '1',
  157. label: '在线支付'
  158. },
  159. {
  160. value: '2',
  161. label: '货到付款'
  162. }
  163. ],
  164. end_address: [],
  165. coupon_title: '', //优惠券提示
  166. };
  167. },
  168. computed: {
  169. ...mapState(['userInfo', 'address', 'start', 'hyaddress'])
  170. },
  171. components: {
  172. longDate
  173. },
  174. onLoad(option) {
  175. this.$store.dispatch('updateUserInfo')
  176. this.coupon_title = this.userInfo.coupon_count + '张优惠券';
  177. this.type = option.id
  178. this.time = option.time
  179. this.money = option.price
  180. this.init()
  181. //额外需求
  182. uni.$on('demand', res => {
  183. console.log(res);
  184. this.demand = res.demand
  185. this.getPrice()
  186. if (res.demand) {
  187. if (res.demand.split(',').length > 2) {
  188. this.demand_name = res.demand_name + '等;'
  189. } else {
  190. this.demand_name = res.demand_name
  191. }
  192. } else {
  193. this.demand_name = "是否需要搬运、返程等服务"
  194. }
  195. })
  196. //备注
  197. uni.$on('remark', res => {
  198. this.remark = res.remark
  199. })
  200. //优惠券
  201. uni.$on("coupon", (res) => {
  202. console.log(res);
  203. this.coupon = res
  204. // this.money = NP.minus(this.money,res.price||0)
  205. this.coupon_title = '-' + res.price
  206. this.getPrice()
  207. })
  208. },
  209. methods: {
  210. init() {
  211. this.$http('/addons/ddrive/freight/Info', {
  212. car_id: this.type
  213. }, "POST").then(data => {
  214. this.img = data.car_image
  215. })
  216. },
  217. getPrice() {
  218. // let coupon_id = this.coupon.id?this.coupon.id:''
  219. this.$http('/addons/ddrive/hyorder/amount', {
  220. start_lat: this.start.latitude,
  221. start_lng: this.start.longitude,
  222. end_address: JSON.stringify(this.hyaddress),
  223. car_id: this.type,
  224. demand: this.demand.includes('2') ? 1 : '',
  225. coupond_id: this.coupon.id || ''
  226. }, "POST").then(data => {
  227. this.money = data.distance_price
  228. }).catch(() => {
  229. this.money = '--'
  230. })
  231. },
  232. // 确定时间
  233. onSelectTime(res) {
  234. console.log(res);
  235. if (res.tip) {
  236. uni.showToast({
  237. title: res.tip,
  238. icon: 'none'
  239. })
  240. } else {
  241. this.time = res.time
  242. this.show = false
  243. }
  244. },
  245. //跟车人数
  246. confirm(e) {
  247. this.num = e[0].label
  248. },
  249. //支付方式
  250. confirm1(e) {
  251. this.pay = e[0].label
  252. if (e[0].label == '货到付款') {
  253. this.iscoupon = false
  254. this.coupon = ''
  255. this.getPrice()
  256. } else {
  257. this.iscoupon = true
  258. this.coupon_title = this.userInfo.coupon_count + '张优惠券';
  259. this.coupon = ''
  260. }
  261. },
  262. //费用标准
  263. goChagre() {
  264. uni.navigateTo({
  265. url: '/pages/huoyun/charge?id=' + this.type
  266. })
  267. },
  268. //额外需求
  269. goDemand() {
  270. uni.navigateTo({
  271. url: '/pages/huoyun/other-demand'
  272. })
  273. },
  274. //备注
  275. goRemark() {
  276. uni.navigateTo({
  277. url: '/pages/huoyun/remark'
  278. })
  279. },
  280. // 优惠券
  281. goCoupon() {
  282. uni.navigateTo({
  283. url: "/pages/my/coupon/list?sf_type=2&id=''&price=" + this.money
  284. })
  285. },
  286. goDetails(id, title) {
  287. uni.navigateTo({
  288. url: '/pages/my/details?id=' + id + '&title=' + title
  289. })
  290. },
  291. submit() {
  292. let coupon_id = this.coupon.id ? this.coupon.id : ''
  293. if (this.num != '请选择跟车人数') {
  294. this.$http('/addons/ddrive/hyorder/create', {
  295. car_id: this.type,
  296. appointment_time: this.time == '预约' ? '' : this.time,
  297. people_num: this.num.split('人')[0],
  298. demand: this.demand,
  299. start_address: JSON.stringify(this.start),
  300. remark: this.remark == '如货物类别等' ? '' : this.remark,
  301. pay_method: this.pay == '在线支付' ? 1 : 2,
  302. mobile: this.userInfo.mobile,
  303. coupon_id: coupon_id,
  304. sh_address: JSON.stringify(this.hyaddress)
  305. }, "POST").then(data => {
  306. if (coupon_id) {
  307. this.$store.dispatch('updateUserInfo')
  308. }
  309. uni.showToast({
  310. title: '提交订单成功',
  311. icon: 'none'
  312. })
  313. uni.redirectTo({
  314. url: this.pay == '在线支付' ? '/pages/huoyun/pay?id=' + data.order_id +
  315. '&coupon_id=' + this.coupon_id : '/pages/huoyun/order-detail?id=' + data
  316. .order_id
  317. })
  318. })
  319. } else {
  320. uni.showToast({
  321. title: '请先选择跟车人数',
  322. icon: 'none'
  323. })
  324. }
  325. }
  326. }
  327. }
  328. </script>
  329. <style lang="scss" scoped>
  330. /deep/.u-primary-hover {
  331. background: linear-gradient(to right,#00b6b4,#00d496) !important;
  332. }
  333. /deep/.active .u-cell__value {
  334. color: #333;
  335. }
  336. /deep/.active .u-cell__value {
  337. color: #333;
  338. }
  339. /deep/.remark .u-cell__value {
  340. margin-left: 80rpx;
  341. overflow: hidden;
  342. white-space: nowrap;
  343. text-overflow: ellipsis;
  344. }
  345. /deep/.red .u-cell__value {
  346. color: $red;
  347. }
  348. .img-header {
  349. height: 100rpx;
  350. image {
  351. width: 100rpx;
  352. height: 100rpx;
  353. }
  354. }
  355. .img-warning {
  356. height: 40rpx;
  357. image {
  358. width: 40rpx;
  359. height: 40rpx;
  360. }
  361. }
  362. </style>