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