info.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="zero">
  5. <scroll-view scroll-y="true" class="scroll-view">
  6. <view class="list-scroll-view">
  7. <view class="one">
  8. <view class="one_1">
  9. <text class="iconfont icon-dingweixiao"></text>
  10. </view>
  11. <view class="one_2">
  12. <view class="name">
  13. <text>{{info.address.name}}</text>
  14. <text>{{info.address.phone}}</text>
  15. </view>
  16. <view class="address">
  17. <text>{{info.address.province}}</text>
  18. <text>{{info.address.city}}</text>
  19. <text>{{info.address.area}}</text>
  20. <text>{{info.address.address}}</text>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="two">
  25. <view class="two_0">
  26. <text>{{info.zhStatus||'未识别'}}</text>
  27. </view>
  28. <view class="two_1" v-if="info.status=='0'">
  29. <view class="list" v-for="(item,index) in info.goods" :key="index">
  30. <view class="list_1">
  31. <text class="iconfont icon-shangdian"></text>
  32. <text>{{item.shop_name}}</text>
  33. </view>
  34. <view class="list_2">
  35. <view class="goods" v-for="(tag,indexs) in item.goods" :key="indexs">
  36. <view class="goods_1">
  37. <view class="url">
  38. <image class="image"
  39. :src="tag.goods.file&&tag.goods.file.length>0?tag.goods.file[0].url:tag.goods.goods.file[0].url"
  40. mode=""></image>
  41. </view>
  42. <view class="goodsname">
  43. {{tag.goods.name}}
  44. <view class="specs">
  45. {{tag.name}}
  46. </view>
  47. </view>
  48. <view class="goodsother">
  49. <view v-if="info.type=='0'" class="price">
  50. ¥{{tag.price||tag.sell_money}}
  51. </view>
  52. <view v-else class="price">
  53. ¥{{tag.group_config.money}}
  54. </view>
  55. <view class="num">
  56. ×{{tag.buy_num}}
  57. </view>
  58. </view>
  59. </view>
  60. <view class="goods_2" v-if="tag.gift.length>0">赠品</view>
  61. <view class="goods_3" v-if="tag.gift.length>0"
  62. v-for="(tags,indexx) in tag.gift" :key="indexx">
  63. <view class="left">
  64. <view class="name">
  65. {{tags.goods_name}}
  66. </view>
  67. <view class="Spec">
  68. 规格:{{tags.spec_name}}
  69. </view>
  70. <view class="Spec">
  71. 说明:{{tags.desc}}
  72. </view>
  73. </view>
  74. <view class="right">
  75. <view class="price">
  76. ¥{{tags.money||0}}
  77. </view>
  78. <view class="num">
  79. ×{{tags.num}}
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <view class="two_2" v-else>
  88. <view class="list_1">
  89. <text class="iconfont icon-shangdian"></text>
  90. <text>{{info.shop.name}}</text>
  91. </view>
  92. <view class="list_2">
  93. <view class="goods" v-for="(item,index) in info.goods" :key="index">
  94. <view class="goods_1">
  95. <view class="url">
  96. <image class="image"
  97. :src="item.file&&item.file.length>0?item.file[0].url:item.goods.file[0].url"
  98. mode="">
  99. </image>
  100. </view>
  101. <view class="goodsname">
  102. {{item.goods.name}}
  103. <view class="specs">
  104. {{item.name}}
  105. </view>
  106. </view>
  107. <view class="goodsother">
  108. <view v-if="info.type=='0'" class="price">
  109. ¥{{item.price||item.sell_money}}
  110. </view>
  111. <view v-else class="price">
  112. ¥{{item.group_config.money}}
  113. </view>
  114. <view class="num">
  115. ×{{item.buy_num}}
  116. </view>
  117. </view>
  118. </view>
  119. <view class="goods_2" v-if="item.gift.length>0">赠品</view>
  120. <view class="goods_3" v-if="item.gift.length>0"
  121. v-for="(tag,indexx) in item.gift" :key="indexx">
  122. <view class="left">
  123. <view class="name">
  124. {{tag.goods_name}}
  125. </view>
  126. <view class="Spec">
  127. 规格:{{tag.spec_name}}
  128. </view>
  129. <view class="Spec">
  130. 说明:{{tag.desc}}
  131. </view>
  132. </view>
  133. <view class="right">
  134. <view class="price">
  135. ¥{{tag.money||0}}
  136. </view>
  137. <view class="num">
  138. ×{{tag.num}}
  139. </view>
  140. </view>
  141. </view>
  142. </view>
  143. </view>
  144. </view>
  145. </view>
  146. <view class="thr">
  147. <view class="thr_1">
  148. <text>商品金额</text>
  149. <text>¥{{info.total_detail.goods_total}}</text>
  150. </view>
  151. <view class="thr_1">
  152. <text>运费</text>
  153. <text>¥{{info.total_detail.freight_total}}</text>
  154. </view>
  155. <view class="thr_1">
  156. <text>实付金额</text>
  157. <text>¥{{info.goods_total}}</text>
  158. </view>
  159. </view>
  160. <view class="four">
  161. <view class="four_1">
  162. <text>订单号</text>
  163. <text>{{info.no}}</text>
  164. </view>
  165. <view class="four_1">
  166. <text>订单状态</text>
  167. <text>{{info.zhStatus||'未识别'}}</text>
  168. </view>
  169. <view class="four_1">
  170. <text>下单时间</text>
  171. <text>{{info.buy_time}}</text>
  172. </view>
  173. <view class="four_1">
  174. <text>订单备注</text>
  175. <text>{{info.remarks}}</text>
  176. </view>
  177. </view>
  178. </view>
  179. </scroll-view>
  180. </view>
  181. <view class="zero_1">
  182. <text>合计</text>
  183. <text>¥{{info.goods_total}}</text>
  184. </view>
  185. </view>
  186. </mobile-frame>
  187. </template>
  188. <script>
  189. export default {
  190. data() {
  191. return {
  192. id: '',
  193. status: '',
  194. info: {},
  195. // 售后状态
  196. statusList: [],
  197. };
  198. },
  199. onLoad: async function(e) {
  200. const that = this;
  201. that.$set(that, `id`, e.id);
  202. that.$set(that, `status`, e.status);
  203. await that.searchOther();
  204. await that.search()
  205. },
  206. onShow: function() {},
  207. methods: {
  208. // 查询详情
  209. async search() {
  210. uni.showLoading({
  211. title: '加载中'
  212. });
  213. const that = this;
  214. let res;
  215. // 待付款
  216. if (that.id && that.status == '0') {
  217. res = await that.$api(`/order/${that.id}`);
  218. } else {
  219. res = await that.$api(`/orderDetail/${that.id}`);
  220. }
  221. if (res.errcode == '0') {
  222. let status = that.statusList.find(i => i.value == res.data.status)
  223. if (status) res.data.zhStatus = status.label;
  224. // 计算优惠劵
  225. // 运费总数和商品总数相加
  226. let total = that.$plus(res.data.total_detail.freight_total, res.data.total_detail.goods_total)
  227. if (res.data?.total_detail?.discount_detail) {
  228. // 有优惠券
  229. var key = Object.keys(res.data.total_detail.discount_detail);
  230. var discount_detail = 0;
  231. for (let val of key) {
  232. for (let var1 in res.data.total_detail.discount_detail[val]) {
  233. // object取key和value
  234. if (Object.hasOwnProperty.call(res.data.total_detail.discount_detail[val], var1)) {
  235. var value = res.data.total_detail.discount_detail[val][var1]
  236. discount_detail = that.$plus(discount_detail, value)
  237. }
  238. }
  239. }
  240. // 优惠劵相减
  241. total = that.$minus(total, discount_detail);
  242. }
  243. if (res.data?.total_detail?.act) {
  244. let act_total = 0;
  245. for (let val of res.data.total_detail.act) act_total = that.$plus(act_total, val.discount)
  246. // 活动相减
  247. total = that.$minus(total, act_total);
  248. }
  249. res.data.goods_total = total
  250. that.$set(that, `info`, res.data);
  251. uni.hideLoading();
  252. }
  253. },
  254. // 查询其他信息
  255. async searchOther() {
  256. const that = this;
  257. let res;
  258. // 查询状态
  259. res = await that.$api(`/dictData`, 'GET', {
  260. code: 'order_process'
  261. })
  262. if (res.errcode == '0') {
  263. that.$set(that, `statusList`, res.data);
  264. }
  265. },
  266. }
  267. }
  268. </script>
  269. <style lang="scss">
  270. .main {
  271. display: flex;
  272. flex-direction: column;
  273. width: 100vw;
  274. height: 100vh;
  275. background-color: #f5f5f5;
  276. .zero {
  277. position: relative;
  278. flex-grow: 1;
  279. .one {
  280. background-color: #fff;
  281. margin: 0 0 2vw 0;
  282. display: flex;
  283. justify-content: space-between;
  284. padding: 2vw;
  285. border-bottom: 2px dashed #ff0000;
  286. .one_1 {
  287. width: 8vw;
  288. text-align: center;
  289. padding: 3vw 0 0;
  290. }
  291. .one_2 {
  292. width: 86vw;
  293. .name {
  294. font-size: 16px;
  295. margin: 0 0 1vw 0;
  296. text {
  297. padding: 0 0 0 2vw;
  298. }
  299. }
  300. .address {
  301. font-size: 14px;
  302. color: #858585;
  303. text {
  304. padding: 0 0 0 2vw;
  305. }
  306. }
  307. }
  308. }
  309. .two {
  310. background-color: #fff;
  311. margin: 0 0 2vw 0;
  312. padding: 2vw;
  313. .two_0 {
  314. text-align: right;
  315. color: #ff0000;
  316. }
  317. .two_1 {
  318. display: flex;
  319. flex-direction: column;
  320. .list {
  321. margin: 0 0 1vw 0;
  322. .list_1 {
  323. font-size: 16px;
  324. margin: 0 0 1vw 0;
  325. text:last-child {
  326. padding: 0 0 0 2vw;
  327. }
  328. }
  329. .list_2 {
  330. display: flex;
  331. flex-direction: column;
  332. .goods {
  333. border-bottom: 1px dashed #f1f1f1;
  334. padding: 2vw 0;
  335. .goods_1 {
  336. display: flex;
  337. .url {
  338. width: 20vw;
  339. .image {
  340. width: 100%;
  341. height: 20vw;
  342. border-radius: 5px;
  343. }
  344. }
  345. .goodsname {
  346. display: flex;
  347. flex-direction: column;
  348. width: 60vw;
  349. padding: 0 2vw;
  350. font-size: 16px;
  351. .specs {
  352. color: var(--f85Color);
  353. font-size: var(--font12Size);
  354. }
  355. }
  356. .goodsother {
  357. width: 15vw;
  358. text-align: right;
  359. }
  360. }
  361. .goods_2 {
  362. padding: 0 1vw 1vw 0;
  363. font-size: var(--font14Size);
  364. }
  365. .goods_3 {
  366. display: flex;
  367. justify-content: space-between;
  368. border: 1px solid var(--fcColor);
  369. border-radius: 5px;
  370. margin: 0 0 1vw 0;
  371. padding: 1vw;
  372. .left {
  373. .name {
  374. font-size: 14px;
  375. }
  376. .Spec {
  377. font-size: var(--font12Size);
  378. color: var(--f85Color);
  379. }
  380. }
  381. }
  382. }
  383. }
  384. }
  385. }
  386. .two_2 {
  387. .list_1 {
  388. font-size: 16px;
  389. margin: 0 0 1vw 0;
  390. text:last-child {
  391. padding: 0 0 0 2vw;
  392. }
  393. }
  394. .list_2 {
  395. display: flex;
  396. flex-direction: column;
  397. .goods {
  398. border-bottom: 1px dashed #f1f1f1;
  399. padding: 2vw 0;
  400. .goods_1 {
  401. display: flex;
  402. .url {
  403. width: 20vw;
  404. .image {
  405. width: 100%;
  406. height: 20vw;
  407. border-radius: 5px;
  408. }
  409. }
  410. .goodsname {
  411. display: flex;
  412. flex-direction: column;
  413. width: 60vw;
  414. padding: 0 2vw;
  415. font-size: 16px;
  416. .specs {
  417. color: var(--f85Color);
  418. font-size: var(--font12Size);
  419. }
  420. }
  421. .goodsother {
  422. width: 15vw;
  423. text-align: right;
  424. }
  425. }
  426. .goods_2 {
  427. padding: 0 1vw 1vw 0;
  428. font-size: var(--font14Size);
  429. }
  430. .goods_3 {
  431. display: flex;
  432. justify-content: space-between;
  433. border: 1px solid var(--fcColor);
  434. border-radius: 5px;
  435. margin: 0 0 1vw 0;
  436. padding: 1vw;
  437. .left {
  438. .name {
  439. font-size: 14px;
  440. }
  441. .Spec {
  442. font-size: var(--font12Size);
  443. color: var(--f85Color);
  444. }
  445. }
  446. }
  447. }
  448. }
  449. }
  450. }
  451. .thr {
  452. background-color: #fff;
  453. margin: 0 0 2vw 0;
  454. padding: 0 2vw;
  455. .thr_1 {
  456. margin: 2vw 0;
  457. font-size: 15px;
  458. display: flex;
  459. justify-content: space-between;
  460. }
  461. .thr_1:last-child {
  462. text:last-child {
  463. color: #ff0000;
  464. }
  465. }
  466. }
  467. .four {
  468. background-color: #fff;
  469. margin: 0 0 2vw 0;
  470. padding: 0 2vw;
  471. .four_1 {
  472. margin: 2vw 0;
  473. font-size: 15px;
  474. display: flex;
  475. justify-content: space-between;
  476. }
  477. }
  478. }
  479. .zero_1 {
  480. background-color: white;
  481. width: 96vw;
  482. padding: 4vw 2vw;
  483. font-size: 16px;
  484. text:last-child {
  485. color: #ff0000;
  486. padding: 0 0 0 2vw;
  487. }
  488. }
  489. }
  490. .scroll-view {
  491. position: absolute;
  492. top: 0;
  493. left: 0;
  494. right: 0;
  495. bottom: 0;
  496. .list-scroll-view {
  497. display: flex;
  498. flex-direction: column;
  499. }
  500. }
  501. </style>