info.vue 11 KB

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