orderdetails.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. <template>
  2. <view class="">
  3. <u-navbar
  4. :title="title"
  5. :placeholder="true"
  6. @leftClick="leftClick"
  7. :autoBack="true"
  8. :safeAreaInsetTop="true"
  9. >
  10. </u-navbar>
  11. <u-loading-page :loading="loadingPage"></u-loading-page>
  12. <view class="page-wrap">
  13. <view class="box distribution u-flex u-row-between"
  14. v-if="orderDetails.status>0"
  15. @click="statusClick">
  16. <view class="left u-flex">
  17. <u--image :showLoading="false" :src="staticUrl+'/img/car.png'" width="48rpx" height="48rpx"></u--image>
  18. <view class="text">
  19. <view class="status">{{orderDetails.status|filterOrderState}}</view>
  20. <view>{{orderDetails.createTime}}</view>
  21. </view>
  22. </view>
  23. <u-icon name="arrow-right" color="#676767" size="24rpx"></u-icon>
  24. </view>
  25. <view class="box addr u-flex u-row-between" v-if="orderDetails.logisticsType!=1">
  26. <view class="left">
  27. <view class="top">
  28. <text class="label" v-if="orderDetails.ifDefault">默认</text>{{orderDetails.address||''}}
  29. </view>
  30. <view class="center">{{orderDetails.receiveAdress}}</view>
  31. <view class="bottom">{{orderDetails.receiveName}} {{orderDetails.receivePhone}}</view>
  32. </view>
  33. <!-- <u-icon name="arrow-right" color="#676767" size="20" @click="selectAddr"></u-icon> -->
  34. </view>
  35. <view class="box pickup-info" v-else>
  36. <view class="item u-flex u-row-between">
  37. <view class="left">
  38. 提货人:
  39. <text>{{pickupInfo.pickupName}}</text>
  40. <text>{{pickupInfo.pickupMobile}}</text>
  41. </view>
  42. <!-- <view class="right">
  43. <u-icon name="arrow-right" color="#676767" size="20"></u-icon>
  44. </view> -->
  45. </view>
  46. <view class="item u-flex u-row-between" @click="pickupTimeShow=true">
  47. <view class="left">
  48. 预约提货时间:
  49. <text>{{pickupInfo.pickupTime}}</text>
  50. </view>
  51. <!-- <view class="right">
  52. <u-icon name="arrow-right" color="#676767" size="20"></u-icon>
  53. </view> -->
  54. </view>
  55. <view class="item u-flex u-row-between">
  56. <view class="left u-flex">
  57. <text style="flex: 1;white-space: nowrap;">自提地点:</text>
  58. <text class="ellipsis-1">{{pickupInfo.pickupAddress}}</text>
  59. </view>
  60. <view class="right">
  61. <u-icon @click="goMap" :name="staticUrl+'/img/go-map-icon-y.png'" color="#676767" size="20"></u-icon>
  62. </view>
  63. </view>
  64. </view>
  65. <!-- <view class="payway page-wrap u-flex u-row-between">
  66. <view class="left">支付方式</view>
  67. <view class="u-flex">
  68. 微信支付
  69. <u-icon name="arrow-right" color="#676767" size="20"></u-icon>
  70. </view>
  71. </view> -->
  72. <view class="box order-product">
  73. <view class="product u-flex" v-for="(item,index) in orderDetails.detailList" :key="item.id">
  74. <u--image :showLoading="true" :src="item.mainImg" width="180rpx" height="180rpx"></u--image>
  75. <view class="text">
  76. <view class="up">
  77. <view class="name ellipsis-2">{{item.goodsName}}</view>
  78. <view class="info">
  79. {{item.specification}}
  80. {{item.unit}}
  81. </view>
  82. </view>
  83. <view class="down u-flex u-row-between">
  84. <view class="left">
  85. <text class="price">¥ <text class="price-num">{{item.price}}</text></text>
  86. </view>
  87. <u-number-box v-model="item.quantity" :disabled="true" @change="changeQuantity(index, $event)" integer></u-number-box>
  88. </view>
  89. </view>
  90. </view>
  91. <!-- logisticsType==1 自提 -->
  92. <view class="" v-if="orderDetails.logisticsType==1" style="font-size: 24rpx;color: #00A447;text-align: right;">
  93. <view class="" v-if="orderDetails.status<=2">请尽快在{{orderDetails.orderShowTime}}小时内提走商品哦</view>
  94. </view>
  95. <!-- logisticsType==2 同城配送 -->
  96. <view class="" v-if="orderDetails.logisticsType==2" style="font-size: 24rpx;color: #00A447;text-align: right;">
  97. <view class="" v-if="orderDetails.status>1">商品将在{{orderDetails.orderShowTime}}小时内配送完成</view>
  98. <view class="" v-else>商品即将开始配送请耐心等待</view>
  99. </view>
  100. </view>
  101. <!-- <view class="page-wrap order-reduced">
  102. <view class="reduced-item u-flex u-row-between u-border-bottom">
  103. <view class="left">
  104. <text>优惠券</text>
  105. <text class="label">已选一张</text>
  106. </view>
  107. <view class="right u-flex">
  108. <text class="price red">-¥ <text class="price-num">1000</text></text>
  109. <u-icon name="arrow-right" color="#676767" size="20"></u-icon>
  110. </view>
  111. </view>
  112. <view class="reduced-item integral u-flex u-row-between">
  113. <view class="left">
  114. <text>积分</text>
  115. <text class="num">3676</text>
  116. <text class="tip">满1000可用</text>
  117. </view>
  118. <view class="right u-flex">
  119. <text class="price red" v-if="useIntegral">-¥ <text class="price-num">1000</text></text>
  120. <u-checkbox-group @change="integralCheckboxChange">
  121. <u-checkbox shape="circle" activeColor="#02AB35" name="integral" ></u-checkbox>
  122. </u-checkbox-group>
  123. </view>
  124. </view>
  125. </view> -->
  126. <view class="box total">
  127. <view class="total-item u-flex u-row-between u-border-bottom">
  128. <view class="left">
  129. 实付金额
  130. </view>
  131. <view class="right red">
  132. ¥ {{orderDetails.realPrice}}
  133. </view>
  134. </view>
  135. <view class="total-item u-flex u-row-between" v-if="orderDetails.logisticsType!=1">
  136. <view class="left">
  137. 运费
  138. <!-- <text class="gray">总重:{{totalWeight}}</text> -->
  139. </view>
  140. <view class="right red">
  141. <text v-if="orderDetails.originalFreightPrice">+ ¥ {{orderDetails.originalFreightPrice}}</text>
  142. <text v-else>免运费</text>
  143. </view>
  144. </view>
  145. </view>
  146. <view class="box order-info page-wrap" v-if="orderDetails.status>0">
  147. <view class="order-info-item" v-for="(item,index) in orderInfo[orderDetails.status]" :key="index">
  148. <text class="til">{{item.name}}</text>
  149. <text class="con">
  150. <text v-if="item.key=='payType'">{{orderDetails[item.key]|filterPayType}}</text>
  151. <text v-else>{{orderDetails[item.key]}}</text>
  152. </text>
  153. </view>
  154. </view>
  155. </view>
  156. <view class="cart-bottom">
  157. <view class="inner u-flex u-row-between">
  158. <view class="left u-flex">
  159. <view class="total-price" v-if="orderDetails.status==0">
  160. 待支付:<text class="red">¥ {{orderDetails.orderPrice}}</text>
  161. </view>
  162. </view>
  163. <!-- <view class="btn" @click="submitOrder">去结算</view> -->
  164. <view class="btn-wrap u-flex">
  165. <view
  166. class="btn"
  167. :class="btn.class"
  168. @click.stop="clickEven(btn.fun,orderDetails)"
  169. v-for="(btn,index) in statusBtn[orderDetails.status]" :key="index">
  170. {{btn.name}}
  171. </view>
  172. </view>
  173. </view>
  174. </view>
  175. </view>
  176. </template>
  177. <script>
  178. export default {
  179. data() {
  180. return {
  181. loadingPage:true,
  182. id:'',
  183. title:'订单详情',
  184. orderDetails:{},
  185. fromPage:'',
  186. useIntegral:false,
  187. dataList:[],
  188. theAddr:{},
  189. isDefaultAddr:false,
  190. staticUrl:this.$commonConfig.staticUrl,
  191. statusBtn:{
  192. 0:[{name:'取消订单',fun:'cancelOrder',class:''},{name:'去支付',fun:'pay',class:'red'}],
  193. 1:[{name:'申请退款',fun:'refund',class:''}],
  194. 2:[{name:'查看物流',fun:'logistics',class:''},{name:'确认收货',fun:'confirmReceipt',class:'green'}],
  195. 3:[{name:'评价',fun:'evaluate',class:'green'}],
  196. // 4:[{name:'查看物流',fun:'logistics',class:''},{name:'评价',fun:'evaluate',class:'green'}],
  197. 5:[{name:'查看退款',fun:'viewRefund',class:''}],
  198. // 6:[{name:'查看退款',fun:'viewRefund',class:'green'}],
  199. 7:[{name:'查看退款',fun:'viewRefund',class:''}]
  200. },
  201. orderInfo:{
  202. 0:[],
  203. 1:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payType'},{name:'支付时间',key:'payTime'}],
  204. 2:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payType'},{name:'支付时间',key:'payTime'}],
  205. 3:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payType'},{name:'支付时间',key:'payTime'},{name:'收货时间',key:'receiveTime'}],
  206. 4:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'}],
  207. 5:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payType'},{name:'支付时间',key:'payTime'}],
  208. 6:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payType'},{name:'支付时间',key:'payTime'}],
  209. 7:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payType'},{name:'支付时间',key:'payTime'}],
  210. },
  211. pickupInfo:{}
  212. }
  213. },
  214. onLoad(page) {
  215. // console.log('page',page);
  216. this.id = page.id;
  217. },
  218. onShow() {
  219. this.getOrderDetails(this.id);
  220. },
  221. computed:{
  222. payType(){
  223. return function(value){
  224. let payTypeList = ['', '微信', '余额', '积分']
  225. return '-' + payTypeList[value]
  226. }
  227. }
  228. },
  229. methods: {
  230. leftClick(){
  231. console.log('orderdetails leftClick');
  232. },
  233. getOrderDetails(id){
  234. this.$u.api.orderDetails({id:id}).then(res=>{
  235. this.loadingPage = false;
  236. this.orderDetails = res.data
  237. this.pickupInfo = res.data.pickupInfo;
  238. // console.log('orderDetails',JSON.parse(JSON.stringify(res.data)));
  239. }).catch(err=>{
  240. console.log('getOrderDetails',err);
  241. })
  242. },
  243. clickEven(fun,item){
  244. // console.log('fun',fun);
  245. let funObj = {
  246. pay: this.pay,
  247. logistics:this.logistics,
  248. evaluate:this.evaluate,
  249. refund:this.refund,
  250. cancelOrder:this.cancelOrder,
  251. viewRefund:this.viewRefund,
  252. confirmReceipt:this.confirmReceipt
  253. };
  254. // console.log('funObj[fun]',funObj[fun]);
  255. if (fun in funObj) {
  256. funObj[fun](item);
  257. }
  258. },
  259. pay(item){
  260. console.log('pay',item);
  261. uni.$u.route('/shopping/pay', {
  262. orderId: item.id,
  263. // openid: that.vuex_wechatOpenid,
  264. payAmount:item.orderPrice
  265. });
  266. },
  267. logistics(item){
  268. // console.log('logistics',item);
  269. uni.$u.route('/shopping/distribution', {
  270. orderId: item.id
  271. });
  272. },
  273. evaluate(item){
  274. // console.log('logistics',item);
  275. uni.$u.route('/shopping/evaluate', {
  276. id: item.id
  277. });
  278. },
  279. refund(item){
  280. // console.log('logistics',item);
  281. uni.$u.route('/shopping/refund', {
  282. id: item.id
  283. });
  284. },
  285. cancelOrder(item){
  286. let that = this;
  287. uni.showModal({
  288. title: '提示',
  289. content: '确认取消吗!',
  290. success: res => {
  291. if (res.confirm) {
  292. this.$u.api.cancelOrder({orderId:item.id}).then(res=>{
  293. this.$refs.uToast.show({
  294. message:res.msg,
  295. complete() {
  296. that.getOrderDetails(that.id);
  297. }
  298. });
  299. // uni.$u.toast(res.msg);
  300. console.log('res',res.data);
  301. }).catch(err=>{
  302. console.log('cancelOrder',err);
  303. })
  304. }
  305. }
  306. });
  307. // console.log('logistics',item);
  308. },
  309. viewRefund(item){
  310. uni.$u.route('/shopping/viewRefund', {
  311. orderId: item.id
  312. });
  313. },
  314. confirmReceipt(item){
  315. let that = this;
  316. uni.showModal({
  317. title: '提示',
  318. content: '确认收货吗!',
  319. success: res => {
  320. if (res.confirm) {
  321. this.$u.api.confirmReceipt({orderId:item.id}).then(res=>{
  322. uni.showToast({
  323. title:res.msg,
  324. duration:2000,
  325. complete() {
  326. that.evaluate(item)
  327. that.getOrderDetails(that.id);
  328. }
  329. });
  330. console.log('res',res.data);
  331. }).catch(err=>{
  332. console.log('confirmReceipt',err);
  333. })
  334. }
  335. }
  336. })
  337. },
  338. goMap(){
  339. uni.openLocation({
  340. latitude: Number(this.pickupInfo.pickupLatitude), //维度
  341. longitude: Number(this.pickupInfo.pickupLongitude), //经度
  342. name: "商行地址", //目的地定位名称
  343. scale: 15, //缩放比例
  344. address: this.pickupInfo.pickupAddress //导航详细地址
  345. })
  346. },
  347. statusClick(){
  348. if (['1', '2'].includes(this.orderDetails.logisticsType)) {
  349. uni.$u.toast('暂无物流信息');
  350. }else{
  351. uni.$u.route('/shopping/distribution', {
  352. orderId: this.orderDetails.id
  353. });
  354. }
  355. }
  356. }
  357. }
  358. </script>
  359. <style>
  360. page{
  361. background-color: #F5F5F5;
  362. }
  363. </style>
  364. <style lang="scss" scoped>
  365. .box{
  366. margin-bottom: 20rpx;
  367. background-color: #fff;
  368. border-radius: 8rpx;
  369. padding: 20rpx;
  370. }
  371. .addr{
  372. .top{
  373. margin-bottom: 16rpx;
  374. font-size: 26rpx;
  375. color: #999;
  376. .label{
  377. background-color: #FFEBEB;
  378. border: 1px solid #FF5F62;
  379. color: #FF5F62;
  380. padding: 5rpx 20rpx;
  381. border-radius: 30rpx;
  382. margin-right: 10rpx;
  383. }
  384. }
  385. .center{
  386. margin-bottom: 10rpx;
  387. font-size: 30rpx;
  388. color: #333;
  389. line-height: 50rpx;
  390. font-weight: 600;
  391. }
  392. .bottom{
  393. font-size: 30rpx;
  394. color: #666;
  395. }
  396. }
  397. .order-reduced{
  398. .reduced-item{
  399. padding-bottom: 30rpx;
  400. &:not(:last-child){
  401. margin-bottom: 30rpx;
  402. }
  403. .label{
  404. border-radius: 2px;
  405. border: 1px solid #FF3C3F;
  406. margin-left: 20rpx;
  407. font-size: 20rpx;
  408. color: #FF3C3F;
  409. padding: 0 10rpx;
  410. }
  411. }
  412. .integral{
  413. .num{
  414. font-size: 30rpx;
  415. color: #02AB35;
  416. font-weight: 600;
  417. margin-left: 30rpx;
  418. margin-right: 16rpx;
  419. }
  420. .tip{
  421. font-size: 24rpx;
  422. color: #999;
  423. }
  424. .price{
  425. margin-right: 10rpx;
  426. }
  427. }
  428. }
  429. .total{
  430. .total-item{
  431. padding-bottom: 30rpx;
  432. &:not(:last-child){
  433. margin-bottom: 30rpx;
  434. }
  435. .right{
  436. font-weight: 600;
  437. }
  438. }
  439. .gray{
  440. font-size: 24rpx;
  441. margin-left: 15rpx;
  442. }
  443. }
  444. .cart-bottom{
  445. height: 98rpx;
  446. .inner{
  447. position: fixed;
  448. background-color: #fff;
  449. height: 98rpx;
  450. left: 0;
  451. right: 0;
  452. bottom: 0;
  453. padding: 0 20rpx;
  454. .total-price{
  455. font-size: 30rpx;
  456. color: #333;
  457. font-weight: 600;
  458. margin-left: 30rpx;
  459. }
  460. .btn{
  461. font-size: 26rpx;
  462. height: 64rpx;
  463. line-height: 64rpx;
  464. border-radius: 50rpx;
  465. padding: 0 40rpx;
  466. border: 1px solid #333;
  467. color: #333;
  468. text-align: center;
  469. background-color: transparent;
  470. margin-left: 10rpx;
  471. &.red{
  472. border-color: #FF3C3F;
  473. background-color: #FF3C3F;
  474. color: #fff;
  475. }
  476. &.green{
  477. border-color: #00A447;
  478. background-color: #00A447;
  479. color: #fff;
  480. }
  481. }
  482. }
  483. }
  484. .product{
  485. .text{
  486. .name{
  487. height: auto;
  488. }
  489. .info{
  490. font-size: 24rpx;
  491. font-weight: 400;
  492. color: #666666;
  493. }
  494. }
  495. }
  496. .order-info{
  497. .order-info-item{
  498. font-size: 30rpx;
  499. font-weight: 400;
  500. color: #333333;
  501. line-height: 42rpx;
  502. padding: 30rpx 20rpx;
  503. &:not(:last-child){
  504. border-bottom: 0.5px solid #eee;
  505. }
  506. .til{
  507. font-size: 24rpx;
  508. font-weight: 400;
  509. color: #999999;
  510. margin-right: 90rpx;
  511. }
  512. }
  513. }
  514. .distribution{
  515. font-size: 24rpx;
  516. font-weight: 400;
  517. color: #00A447;
  518. line-height: 33rpx;
  519. .text{
  520. margin-left: 16rpx;
  521. }
  522. .status{
  523. margin-bottom: 10rpx;
  524. font-size: 30rpx;
  525. font-weight: 600;
  526. color: #00A447;
  527. line-height: 38rpx;
  528. }
  529. }
  530. </style>