order.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. <template>
  2. <van-skeleton :loading="loading">
  3. <view class="cart-list">
  4. <view style="padding: 0 36upx;line-height: 70upx; border-bottom: 14upx solid #F5F5F5; border-top: 1px solid #F5F5F5;">
  5. <span>{{ detail.status }}</span>
  6. </view>
  7. <view class="adress">
  8. <view class="adressDetail">{{ detail.reciver_info.mob_phone }}</view>
  9. <view>{{ detail.reciver_info.address }}</view>
  10. </view>
  11. <view @click="goStore" style="padding: 30upx 36upx 15upx 36upx;border-bottom: 1px solid #F5F5F5;">
  12. <image
  13. :src="pictureUrl + '/uploads/home/store/' + detail.store_id + '/' + detail.store_avatar"
  14. style="border-radius: 50%; width: 50upx;height: 50upx;vertical-align: middle;"
  15. ></image>
  16. <span style="padding-left: 16upx;">{{ detail.store_name }}</span>
  17. </view>
  18. <view class="shoplist" v-for="(items, index) in detail.goods" :key="index">
  19. <view @click="goDetail(items)">
  20. <van-card
  21. title-class="changewidth"
  22. price-class="priceClass"
  23. :price="items.goods_price"
  24. :desc="items.descire"
  25. :title="items.desarray"
  26. :thumb="pictureUrl + '/uploads/home/store/goods/' + items.goods_image.substr(0, items.goods_image.indexOf('\_')) + '/' + items.goods_image"
  27. ></van-card>
  28. </view>
  29. <view style="clear:both;width: 100%;overflow: hidden;padding: 20rpx 0;">
  30. <view class="retungood" v-if="detail.status == '已收货' && items.status == 2" @click="goreturngood(items)">退货退款</view>
  31. <view class="retungood" v-if="detail.status == '已收货' && items.status == 4" @click="goreturndetail(items.or_id)">退款成功</view>
  32. <view class="retungood" v-if="detail.status == '已收货' && items.status == 3" @click="goreturndetail(items.or_id)">退款申请中</view>
  33. </view>
  34. </view>
  35. <view class="topTip">
  36. <view style="padding-right: 20upx;">运费: {{ detail.shipping_fee }}</view>
  37. <view style="font-size: 28upx;">合计:{{ detail.order_amount }}</view>
  38. </view>
  39. <view style="padding: 18upx 36upx;">
  40. 订单编号:
  41. <text class="orderCode">{{ detail.order_sn }}</text>
  42. </view>
  43. <view
  44. v-if="detail.shipping_code != ''"
  45. style="margin: 20upx 0;
  46. padding: 10upx 0 0upx 32upx;
  47. border-top: 16upx solid #F5F5F5;
  48. border-top: 16upx solid #F5F5F5;"
  49. >
  50. <view>
  51. 快递单号:
  52. <text style="font-weight: 500;padding-left:16upx;" class="time">{{ detail.shipping_code }} ({{ detail.express_name }})</text>
  53. </view>
  54. </view>
  55. <view class="adressbottom">
  56. <view>
  57. 下单时间:
  58. <text style="font-weight: 500;" class="time">{{ detail.add_time }}</text>
  59. </view>
  60. <view>
  61. 支付订单:
  62. <text class="time" v-if="detail.order_state == 10 || detail.order_state == 0">未支付</text>
  63. <text class="time" v-else>{{ detail.payment_time }}</text>
  64. </view>
  65. <view>
  66. 商家发货:
  67. <text class="time" v-if="detail.order_state == 10 || detail.order_state == 0 || detail.order_state == 20 || detail.order_state == 60">未发货</text>
  68. <text class="time" v-else>{{ happenTimeFun(detail.shipping_time) }}</text>
  69. </view>
  70. <view>
  71. 确认收货:
  72. <text
  73. class="time"
  74. v-if="detail.order_state == 10 || detail.order_state == 0 || detail.order_state == 20 || detail.order_state == 30 || detail.order_state == 60"
  75. >
  76. 未确认
  77. </text>
  78. <text class="time" v-else>{{ detail.finnshed_time }}</text>
  79. </view>
  80. </view>
  81. <view class="adressbutton">
  82. <view class="buttonStatus">
  83. <view @click="returnmoney()" v-if="detail.order_state == 20" class="deleteOrder">退款</view>
  84. <view @click="reminder(1)" v-if="detail.order_state == 20 && detail.shipping_type == 0" class="deleteOrder">催单</view>
  85. <view @click="reminder(2)" v-if="detail.order_state == 20 && detail.shipping_type == 1" class="deleteOrder">联系酒店</view>
  86. <view @click="cancelOrder(1)" v-if="detail.order_state == 10" class="deleteOrder">取消订单</view>
  87. <view class="payOrder" v-if="detail.order_state == 10" @click="goPay(detail)">去付款</view>
  88. <view v-if="detail.status == '已发货'" @click="cancelOrder(3)" class="deleteOrder">确认收货</view>
  89. <view
  90. v-if="(detail.status == '已收货' && detail.evaluation_state == 0) || (detail.status == '已完成' && detail.evaluation_state == 0)"
  91. @click="estimate"
  92. class="deleteOrder"
  93. >
  94. 去评价
  95. </view>
  96. <view
  97. v-if="(detail.order_state == 40 && detail.evaluation_state == 1) || detail.status == '已取消' || detail.status == '退款关闭'"
  98. @click="cancelOrder(2)"
  99. class="deleteOrder"
  100. >
  101. 删除订单
  102. </view>
  103. </view>
  104. </view>
  105. <Dialog :orderCancel="orderCancel" :titles="titles" @colseDialog="cancelDialog" @confirmPay="confirmOrder" />
  106. <view class="openSelect" v-if="radioShow">
  107. <view class="openSelectTitle">请选择退款的理由</view>
  108. <van-radio-group :value="radio" @change="onChange">
  109. <van-cell-group>
  110. <van-cell :title="item.name" clickable :data-name="item.value" @click="onClick" v-for="(item, index) in radioItems" :key="index">
  111. <van-radio checked-color="#E72028" slot="right-icon" :name="item.value" />
  112. </van-cell>
  113. </van-cell-group>
  114. </van-radio-group>
  115. <van-field :value="textarea" @change="changatextarea" type="textarea" placeholder="请输入退款理由" v-if="radio == 5" />
  116. <view class="flex-box btns">
  117. <view class="flex-1" @click="cancelDialog2()">取消</view>
  118. <view class="flex-1" @click="confirmOrder2()">确定</view>
  119. </view>
  120. </view>
  121. </view>
  122. <view class="weui-mask" v-if="radioShow"></view>
  123. </van-skeleton>
  124. </template>
  125. <script>
  126. import Dialog from '@/component/Dialog.vue';
  127. export default {
  128. components: {
  129. Dialog
  130. },
  131. data() {
  132. return {
  133. firstloading: 0,
  134. loading: true,
  135. isreturn: false,
  136. isCancel: false,
  137. isDelete: false,
  138. isGet: false,
  139. titles: '',
  140. pictureUrl: this.pictureUrl,
  141. orderCancel: false,
  142. detail: {},
  143. id: '', // 订单id
  144. radioShow: false,
  145. radio: 1,
  146. radioItems: [
  147. { name: '拍错/多拍/不想要', value: 1 },
  148. { name: '协商一致退货', value: 2 },
  149. { name: '缺货', value: 3 },
  150. { name: '未按约定时间发货', value: 4 },
  151. { name: '其他', value: 5 }
  152. ],
  153. textarea: ''
  154. };
  155. },
  156. onLoad(e) {
  157. this.id = e.id;
  158. this.getDetail();
  159. // 刷新订单详情
  160. uni.$on('refshlist', e => {
  161. this.getDetail();
  162. });
  163. },
  164. methods: {
  165. changatextarea(e) {
  166. this.textarea = e.detail;
  167. },
  168. onChange(event) {
  169. this.radio = event.detail;
  170. },
  171. onClick(event) {
  172. const { name } = event.currentTarget.dataset;
  173. this.radio = name;
  174. },
  175. goStore() {
  176. let id = this.detail.store_id;
  177. uni.navigateTo({
  178. url: `/pages/index/hotel?id=${id}`
  179. });
  180. },
  181. happenTimeFun(num) {
  182. //时间戳数据处理
  183. let date = new Date(num * 1000);
  184. //时间戳为10位需*1000,时间戳为13位的话不需乘1000
  185. let y = date.getFullYear();
  186. let MM = date.getMonth() + 1;
  187. MM = MM < 10 ? '0' + MM : MM; //月补0
  188. let d = date.getDate();
  189. d = d < 10 ? '0' + d : d; //天补0
  190. let h = date.getHours();
  191. h = h < 10 ? '0' + h : h; //小时补0
  192. let m = date.getMinutes();
  193. m = m < 10 ? '0' + m : m; //分钟补0
  194. let s = date.getSeconds();
  195. s = s < 10 ? '0' + s : s; //秒补0
  196. return y + '-' + MM + '-' + d + ' ' + h + ':' + m; //年月日
  197. //return y + '-' + MM + '-' + d + ' ' + h + ':' + m+ ':' + s; //年月日时分秒
  198. },
  199. goDetail(e) {
  200. let id = e.goods_commonid;
  201. let store_id = e.store_id;
  202. uni.navigateTo({
  203. url: `/pages/index/shop?id=${id}&store_id=${store_id}`
  204. });
  205. },
  206. // 退货退款
  207. goreturngood(item) {
  208. item.statusremak = this.detail.status;
  209. item.order_id = this.id;
  210. item.store_avatar = this.detail.store_avatar;
  211. item.store_name = this.detail.store_name;
  212. item.order_sn = this.detail.order_sn;
  213. let id = JSON.stringify(item);
  214. uni.navigateTo({
  215. url: `/pages/myOrder/returngood?id=${id}` // 退货页面
  216. });
  217. },
  218. // 退款详情
  219. goreturndetail(e) {
  220. let id = e;
  221. uni.navigateTo({
  222. url: `/pages/myOrder/returndetail?id=${id}` // 退货详情页面
  223. });
  224. },
  225. getDetail() {
  226. uni.showLoading({
  227. title: '加载中',
  228. mask: true
  229. });
  230. this.request({
  231. url: '/v2/order/info',
  232. method: 'post',
  233. data: {
  234. order_id: this.id
  235. },
  236. success: res => {
  237. let { data } = res.data;
  238. data.goods.forEach((items, index) => {
  239. let arr = items.goods_name.split(' ');
  240. items.desarray = arr[0];
  241. items.descire = items.goods_name.replace(arr[0], '');
  242. });
  243. this.detail = data;
  244. uni.hideLoading();
  245. if (this.firstloading == 0) {
  246. this.loading = false;
  247. }
  248. this.firstloading = 1;
  249. }
  250. });
  251. },
  252. // 退款
  253. returnmoney() {
  254. this.isreturn = true;
  255. this.radioShow = true;
  256. },
  257. // 取消订单
  258. cancelOrder(e) {
  259. if (e == 1) {
  260. this.titles = '确认取消订单?';
  261. this.isCancel = true;
  262. } else if (e == 3) {
  263. this.titles = '确认收货?';
  264. this.isGet = true;
  265. } else if (e == 4) {
  266. this.titles = '确定退款?';
  267. this.isreturn = true;
  268. } else {
  269. this.titles = '确认删除订单?';
  270. this.isDelete = true;
  271. }
  272. this.orderCancel = true;
  273. },
  274. cancelDialog() {
  275. this.orderCancel = false;
  276. this.isreturn = false;
  277. this.isCancel = false;
  278. this.isDelete = false;
  279. this.isGet = false;
  280. },
  281. cancelDialog2() {
  282. this.radioShow = false;
  283. this.isreturn = false;
  284. this.textarea = '';
  285. this.radio = 1;
  286. },
  287. confirmOrder2() {
  288. var str = this.radioItems[this.radio - 1].name;
  289. var data = { order_id: this.id };
  290. data.remark = str;
  291. if (this.radio == 5) {
  292. console.log(this.textarea);
  293. if (!this.textarea) {
  294. this.$msg('请输入退款理由');
  295. return false;
  296. } else {
  297. data.remark = this.textarea;
  298. }
  299. }
  300. this.request({
  301. url: '/v3/Order/refund_direct',
  302. method: 'post',
  303. data: data,
  304. success: res => {
  305. if (res.data.code == 1000) {
  306. uni.$emit('refehlist');
  307. if (this.isreturn) {
  308. this.cancelDialog2();
  309. this.getDetail();
  310. }
  311. } else {
  312. this.$msg(res.data.msg);
  313. this.cancelDialog2();
  314. }
  315. }
  316. });
  317. },
  318. confirmOrder() {
  319. let url = '';
  320. var data = { order_id: this.id };
  321. this.orderCancel = false;
  322. // 取消
  323. if (this.isCancel) {
  324. url = '/v2/order/cancel';
  325. } else if (this.isDelete) {
  326. // 删除
  327. url = '/v2/order/drop';
  328. } else if (this.isGet) {
  329. // 收货
  330. url = '/v2/order/confirm';
  331. }
  332. this.request({
  333. url: url,
  334. method: 'post',
  335. data: data,
  336. success: res => {
  337. if (res.data.code == 1000) {
  338. if (this.isDelete) {
  339. this.$msg('删除成功');
  340. } else if (this.isGet) {
  341. this.$msg('收货成功');
  342. } else if (this.isCancel) {
  343. this.$msg('取消成功');
  344. }
  345. uni.$emit('refehlist');
  346. setTimeout(() => {
  347. uni.navigateBack();
  348. }, 1000);
  349. } else {
  350. this.$msg(res.data.msg);
  351. }
  352. }
  353. });
  354. },
  355. goPay(e) {
  356. let prices = this.detail.order_amount;
  357. let order_id = this.id;
  358. let store_id = e.store_id;
  359. let isform = 1;
  360. uni.navigateTo({
  361. url: `/pages/myOrder/paymoment?order_id=${order_id}
  362. &prices=${prices}&isform=${isform}&store_id=${store_id}`
  363. });
  364. },
  365. // 催单
  366. reminder(e) {
  367. let a = e;
  368. let order_id = this.id;
  369. uni.navigateTo({
  370. url: `/pages/myOrder/reminder?order_id=${order_id}&a=${a}`
  371. });
  372. },
  373. // 评价晒单
  374. estimate() {
  375. let order_id = this.id;
  376. uni.navigateTo({
  377. url: `/pages/myOrder/estimate?order_id=${order_id}`
  378. });
  379. }
  380. }
  381. };
  382. </script>
  383. <style lang="scss">
  384. .openSelectTitle {
  385. padding: 30upx;
  386. color: #999;
  387. }
  388. .weui-mask {
  389. position: fixed;
  390. z-index: 998;
  391. top: 0;
  392. right: 0;
  393. left: 0;
  394. bottom: 0;
  395. background: rgba(0, 0, 0, 0.6);
  396. // display: none;
  397. }
  398. .openSelect {
  399. position: absolute;
  400. position: fixed;
  401. left: 10%;
  402. right: 10%;
  403. background-color: #fff;
  404. border-radius: 10px;
  405. z-index: 999;
  406. top: 20%;
  407. // display: none;
  408. }
  409. .btns view {
  410. text-align: center;
  411. padding: 30upx;
  412. color: #222;
  413. }
  414. .btns view:nth-child(2) {
  415. border-left: 1px solid #f1f1f1;
  416. color: #d60e15;
  417. }
  418. .tkText {
  419. padding: 0 20upx 20upx 20upx;
  420. color: #ccc;
  421. }
  422. page {
  423. background-color: #f5f5f5;
  424. }
  425. .cart-list {
  426. background-color: #fff;
  427. }
  428. .topTip {
  429. display: flex;
  430. align-items: center;
  431. justify-content: flex-start;
  432. padding: 20upx 36upx;
  433. }
  434. .changewidth {
  435. color: #303133;
  436. font-size: 32upx;
  437. font-weight: 100 !important;
  438. }
  439. .priceClass {
  440. color: #303133 !important;
  441. font-weight: normal !important;
  442. font-size: 36upx;
  443. }
  444. .van-card {
  445. background-color: #fff !important;
  446. }
  447. .shoplist {
  448. padding: 10upx 32upx;
  449. border-bottom: 1px solid #f5f5f5;
  450. // display: flex;
  451. // justify-content: space-between;
  452. // align-items: center;
  453. }
  454. .retungood {
  455. text-align: right;
  456. padding: 0upx 32upx;
  457. float: right;
  458. border: 1px solid #666;
  459. //margin-right: 32upx;
  460. }
  461. .adress {
  462. padding: 35upx 36upx;
  463. border-bottom: 14upx solid #f5f5f5;
  464. }
  465. .adressDetail {
  466. padding: 15upx 0;
  467. }
  468. .orderCode {
  469. padding-left: 15upx;
  470. font-weight: 500;
  471. }
  472. .adressbottom {
  473. padding: 0 36upx;
  474. color: #606266;
  475. border-top: 16upx solid #f5f5f5;
  476. padding-bottom: 32upx;
  477. margin-bottom: 100upx;
  478. view {
  479. padding: 32upx 0 0 0;
  480. }
  481. .time {
  482. padding-left: 16upx;
  483. }
  484. }
  485. .adressbutton {
  486. position: fixed;
  487. bottom: 0;
  488. width: 100%;
  489. .buttonStatus {
  490. display: flex;
  491. text-align: center;
  492. .deleteOrder {
  493. flex: 1;
  494. color: #303133;
  495. font-size: 32upx;
  496. background-color: #fff;
  497. padding: 25upx 0;
  498. }
  499. .payOrder {
  500. flex: 1;
  501. font-size: 32upx;
  502. color: #fff;
  503. background-color: #d9332e;
  504. padding: 10px 0;
  505. }
  506. }
  507. }
  508. </style>