info.vue 12 KB

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