record_detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. <template>
  2. <div class="order_detail">
  3. <div class="address_card">
  4. <div class="top">
  5. <image src="@/static/images/gift/local.png" mode="" class="icon"></image>
  6. <div>下单地址</div>
  7. </div>
  8. <div class="address">
  9. {{detail.sjr_name}},{{detail.sjr_mobile}},{{detail.sjr_address_province}}{{detail.sjr_address_city}}{{detail.sjr_address_area}}{{detail.sjr_address}}
  10. </div>
  11. </div>
  12. <div class="order">
  13. <div class="btn" v-if="detail.status==1">
  14. <div class="btn_item change_address" @click="changeAddress">更改地址</div>
  15. <div class="btn_item zuofei" @click="handleZF">作废</div>
  16. </div>
  17. <div class="order_detail">
  18. <div class="tag zuofei" v-if="detail.status==0">已作废</div>
  19. <div class="tag wait" v-if="detail.status==1">待审核</div>
  20. <div class="tag wait_fh" v-if="detail.status==2">待发货</div>
  21. <div class="tag all_fh" v-if="detail.status==3">待收货</div>
  22. <div class="tag complate" v-if="detail.status==4">已完成</div>
  23. <div class="time">下单时间:{{detail.order_time}}</div>
  24. <div class="time">订单编号:{{detail.order_no}}</div>
  25. <div class="goods" v-for="item in detail.goods" :key="item.id">
  26. <div class="icon">
  27. <image :src="item.good ? item.good.cover :'--'" mode="" class="icon"></image>
  28. </div>
  29. <div class="right">
  30. <div class="name">{{item.good ? item.good.name :'--'}}</div>
  31. <div class="btn">
  32. <div class="num">数量:{{item.nums}}</div>
  33. <div class="jifen">-{{item.jifen}}<span style="font-size: 12px;">积分</span></div>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="zongji">
  38. <div>商品种类:<span>{{detail.goods ? detail.goods.length :0}}</span></div>
  39. <div>商品数量:<span>{{detail.nums}}</span></div>
  40. <div>商品总额:<span class="num">{{detail.jifen}}</span><span class="num"
  41. style="font-size: 12px;">积分</span></div>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="wuliu" v-if="detail.status==3 || detail.status==4">
  46. <div class="top">
  47. <image src="@/static/images/gift/wuliu.png" mode="" class="icon"></image>
  48. <div>物流信息</div>
  49. </div>
  50. <div class="step" style="margin-top: 10px;">
  51. <div class="step_item grey " v-if="detail.wuliu_no || detail.wuliu_type">
  52. <div class="wuliu_no">【快递编号】<span class="email_mobile">{{detail.wuliu_no || '--'}}</span></div>
  53. <div class="wuliu_no" style="margin-top: 10px;">【物流公司】{{detail.wuliu_type || '--'}}</div>
  54. </div>
  55. </div>
  56. <div class="step" v-if="expressList.length>0">
  57. <div class="step_list">
  58. <div class="step_item grey" v-for="(item,index) in expressList">
  59. <div class="location">{{item.AcceptStation}}</div>
  60. <div class="update_time">{{getTime(item.AcceptTime)}}</div>
  61. <!-- <image src="@/static/images/gift/step_2.png" mode="" class="now"></image> -->
  62. <image src="@/static/images/gift/step_1.png" mode="" class="no_arrive"></image>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <!-- 订单作废弹窗 -->
  68. <u-popup v-model="zfPopup" mode="bottom" border-radius="16">
  69. <div class="pop_title">作废订单原因</div>
  70. <div class="reason">
  71. <div class="item" v-for="(item,index) in reasonList" :key="index" @click="selectReason(item,index)">
  72. <div class="text">{{item}}</div>
  73. <image v-if="index == curReason" src="@/static/images/login/agree.png" mode="" class="option_image">
  74. </image>
  75. <div v-else class="option"></div>
  76. </div>
  77. <div class="item" style="border:none" @click="otherMethReason(4)">
  78. <div class="text">其他原因</div>
  79. <image v-if="curReason==4" src="@/static/images/login/agree.png" mode="" class="option_image">
  80. </image>
  81. <div v-else class="option"></div>
  82. </div>
  83. <div class="text-area" v-if="curReason==4">
  84. <u-input v-model="otherReason" type="textarea" :border="false" :height="200"
  85. :custom-style="{'background-color': '#F8F8F8','padding':'12px','border-radius': '8px'}" />
  86. </div>
  87. </div>
  88. <div class="button">
  89. <div class="btn cancel" @click="handleCancel">取消作废</div>
  90. <div class="btn btn_zf" @click="sureZf">确定作废</div>
  91. </div>
  92. </u-popup>
  93. </div>
  94. </template>
  95. <script>
  96. export default {
  97. data() {
  98. return {
  99. zfPopup: false,
  100. detail: {},
  101. reasonList: ['收货信息错了', '数量错了', '订单下多了'],
  102. close_order_reson: '',
  103. curReason: 0,
  104. otherReason: '',
  105. id: '',
  106. expressList: [], //快递列表
  107. }
  108. },
  109. onLoad(option) {
  110. this.id = option.id
  111. this.getOrderDetail(option.id)
  112. this.close_order_reson = this.reasonList[this.curReason]
  113. },
  114. created() {
  115. uni.$on('CHOOSEADDRESS', (item) => {
  116. console.log('地址')
  117. this.changeAddressApi(item)
  118. });
  119. },
  120. methods: {
  121. getTime(timestamp) {
  122. const date = new Date(timestamp);
  123. const year = date.getFullYear();
  124. const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1
  125. const day = String(date.getDate()).padStart(2, '0');
  126. const hours = String(date.getHours()).padStart(2, '0');
  127. const minutes = String(date.getMinutes()).padStart(2, '0');
  128. const seconds = String(date.getSeconds()).padStart(2, '0');
  129. const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  130. return formattedDate
  131. },
  132. //取消作废
  133. handleCancel() {
  134. this.zfPopup = false
  135. },
  136. //更改地址
  137. changeAddress() {
  138. uni.navigateTo({
  139. url: '/pages/address/list?page=record'
  140. })
  141. },
  142. //
  143. changeAddressApi(item) {
  144. this.$u.post('/dwbs/shop/order/update-address', {
  145. id: this.id,
  146. address_id: item.id
  147. }).then(res => {
  148. this.$u.toast('地址修改成功!')
  149. // uni.$off('CHOOSEADDRESS')
  150. this.getOrderDetail()
  151. })
  152. },
  153. //作废
  154. handleZF() {
  155. this.zfPopup = true
  156. },
  157. //确定作废
  158. sureZf() {
  159. if (this.curReason == 4 && !this.otherReason) {
  160. this.$u.toast('请输入作废原因')
  161. return
  162. }
  163. if (this.curReason == 4 && this.otherReason) {
  164. this.close_order_reson = this.otherReason
  165. }
  166. console.log(this.close_order_reson)
  167. this.$u.post('/dwbs/shop/order/close', {
  168. id: this.detail.id,
  169. close_order_reason: this.close_order_reson
  170. }).then(res => {
  171. this.$u.toast('作废成功')
  172. this.zfPopup = false
  173. setTimeout(() => {
  174. this.getOrderDetail()
  175. this.getUserInfo()
  176. }, 1500)
  177. })
  178. },
  179. //获取当前用户的信息
  180. getUserInfo() {
  181. this.$u.get('/base/auth/me').then(res => {
  182. this.$u.vuex('vuex_user', res.data)
  183. })
  184. },
  185. //选择作废原因
  186. selectReason(item, index) {
  187. this.curReason = index
  188. this.close_order_reson = item
  189. this.otherReason = ''
  190. },
  191. //其他作废原因
  192. otherMethReason(index) {
  193. this.curReason = index
  194. },
  195. //兑换订单详情
  196. getOrderDetail() {
  197. this.$u.get('/dwbs/shop/order', {
  198. id: this.id
  199. }).then(res => {
  200. this.detail = res.data
  201. this.searchFastMail()
  202. })
  203. },
  204. // 查询快递
  205. searchFastMail() {
  206. this.$u.get('/dwbs/shop/order/express', {
  207. id: this.id
  208. }).then(res => {
  209. console.log(res)
  210. let data = res.data
  211. this.express = data
  212. if (data.State !== false) this.expressList = data.Traces.length > 0 ? data.Traces : []
  213. })
  214. }
  215. }
  216. }
  217. </script>
  218. <style lang="scss" scoped>
  219. page {
  220. background-color: #f5f5f5;
  221. padding-top: 14px;
  222. .top {
  223. display: flex;
  224. align-items: center;
  225. font-size: 18px;
  226. .icon {
  227. width: 27px;
  228. height: 27px;
  229. margin-right: 7px;
  230. }
  231. }
  232. .address_card {
  233. background-color: #fff;
  234. border-radius: 10px;
  235. padding: 20px;
  236. .address {
  237. margin-top: 22px;
  238. color: #707070;
  239. font-size: 17px;
  240. }
  241. }
  242. .order {
  243. background-color: #fff;
  244. padding: 16px 12px;
  245. border-radius: 10px;
  246. margin-top: 10px;
  247. .btn {
  248. display: flex;
  249. justify-content: center;
  250. align-items: center;
  251. .btn_item {
  252. width: 130px;
  253. height: 40px;
  254. text-align: center;
  255. line-height: 40px;
  256. color: #fff;
  257. border-radius: 30px;
  258. }
  259. .change_address {
  260. background: linear-gradient(180deg, #FFA700 0%, #FFBA00 100%);
  261. margin-right: 30px;
  262. }
  263. .zuofei {
  264. /* 按钮渐变 */
  265. background: linear-gradient(90deg, #FB7B58 0%, #F5222D 97%);
  266. }
  267. }
  268. .order_detail {
  269. padding: 14px;
  270. border-radius: 10px;
  271. background: #F9F9F9;
  272. margin-top: 14px;
  273. position: relative;
  274. .time {
  275. color: #3E3E3E;
  276. font-size: 14px;
  277. margin-bottom: 5px;
  278. }
  279. .goods {
  280. display: flex;
  281. margin-top: 19px;
  282. .icon {
  283. background-color: #fff;
  284. width: 80px;
  285. height: 64px;
  286. margin-right: 12px;
  287. border: solid 1px #fff;
  288. border-radius: 10px;
  289. overflow: hidden;
  290. }
  291. .right {
  292. flex: 1;
  293. align-items: center;
  294. .name {
  295. font-size: 18px;
  296. color: #333333;
  297. }
  298. .btn {
  299. margin-top: 22px;
  300. display: flex;
  301. .num {
  302. flex: 1;
  303. font-size: 16px;
  304. color: #6F6F6F;
  305. }
  306. .jifen {
  307. font-size: 20px;
  308. color: #FF0000;
  309. }
  310. }
  311. }
  312. }
  313. .zongji {
  314. padding: 27px 0;
  315. font-size: 18px;
  316. color: #333333;
  317. span {
  318. font-size: 20px;
  319. }
  320. div {
  321. margin-bottom: 14px;
  322. }
  323. .num {
  324. color: #FF1438;
  325. }
  326. }
  327. .tag {
  328. position: absolute;
  329. width: 53px;
  330. height: 20px;
  331. line-height: 20px;
  332. text-align: center;
  333. top: 0;
  334. right: 0;
  335. border-radius: 0px 10px 0px 10px;
  336. opacity: 1;
  337. color: #FFFFFF;
  338. font-size: 12px;
  339. }
  340. .wait {
  341. background: #FAC858;
  342. }
  343. .zuofei {
  344. background: #A458FA;
  345. }
  346. .wait_fh {
  347. background: #FA9B58;
  348. }
  349. .all_fh {
  350. background: #586EFA;
  351. }
  352. .complate {
  353. background: #FF0000;
  354. }
  355. }
  356. }
  357. .pop_title {
  358. color: #333333;
  359. font-size: 18px;
  360. padding: 19px 0;
  361. text-align: center;
  362. }
  363. .reason {
  364. padding: 0 12px;
  365. .item {
  366. padding: 16px 0;
  367. display: flex;
  368. align-items: center;
  369. border-bottom: 1px solid #EEEEEE;
  370. .text {
  371. color: #333333;
  372. font-size: 17px;
  373. flex: 1;
  374. }
  375. .option {
  376. width: 20px;
  377. height: 20px;
  378. }
  379. .option_image {
  380. width: 24px;
  381. height: 24px;
  382. }
  383. .option {
  384. border: solid 1px #999999;
  385. border-radius: 50%;
  386. }
  387. }
  388. .text-area {
  389. // margin-top: 20px;
  390. }
  391. }
  392. .button {
  393. padding: 10px 0;
  394. border-top: solid 1px #EEEEEE;
  395. display: flex;
  396. align-items: center;
  397. justify-content: center;
  398. .btn {
  399. width: 154px;
  400. height: 44px;
  401. text-align: center;
  402. line-height: 44px;
  403. border-radius: 22px;
  404. }
  405. .cancel {
  406. background: #FFF4F3;
  407. border: 1px solid #FB231F;
  408. color: #FB231F;
  409. margin-right: 15px;
  410. }
  411. .btn_zf {
  412. color: #FFFFFF;
  413. background: linear-gradient(91deg, #F30000 1%, #FE4815 99%);
  414. }
  415. }
  416. .wuliu {
  417. padding: 22px;
  418. margin-top: 16px;
  419. background-color: #fff;
  420. .wuliu_no {
  421. font-size: 16px;
  422. }
  423. .step_list {
  424. margin-top: 20px;
  425. .step_item {
  426. border-left: solid 1px #EEEEEE;
  427. padding-bottom: 30px;
  428. padding-left: 18px;
  429. color: #FF0000;
  430. font-size: 14px;
  431. position: relative;
  432. .email_mobile {
  433. color: #3366FF
  434. }
  435. .now {
  436. position: absolute;
  437. height: 16px;
  438. width: 16px;
  439. top: 0;
  440. left: -8px;
  441. }
  442. .no_arrive {
  443. position: absolute;
  444. height: 10px;
  445. width: 10px;
  446. top: 0;
  447. left: -5px;
  448. }
  449. .location {}
  450. .update_time {
  451. margin-top: 5px;
  452. }
  453. }
  454. .grey {
  455. color: #999999;
  456. }
  457. }
  458. }
  459. }
  460. </style>