detail.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <view>
  3. <u-navbar title="订单详情" :border="true" :placeholder="true" :autoBack="true" leftIconColor="#fff"
  4. bgColor="#E96737" />
  5. <view class="detail">
  6. <view class="detail-state">
  7. <view class="detail-state-title">
  8. <text>订单状态:</text>
  9. <text>{{ status.desc }}</text>
  10. </view>
  11. </view>
  12. <view class="detail-info">
  13. <view class="detail-info-title">商品信息</view>
  14. <view class="detail-info-content">
  15. <view class="detail-info-content-goods">
  16. <view class="flex detail-info-content-goods__detail" v-for="(item, index) in list" :key="index">
  17. <view class="detail-info-content-goods__detail__left">
  18. <view class="img">
  19. <image class="img" :src="item.picUrl" mode="aspectFill">
  20. </image>
  21. </view>
  22. <view class="info">
  23. <text>{{ item.title }}</text>
  24. <text>面值:{{ $numberFormat(item.facePrice) }}元</text>
  25. <text>规格:{{ item.pkgUnit }}张/包 </text>
  26. </view>
  27. </view>
  28. <view class="detail-info-content-goods__detail__right">
  29. <text>¥{{ $numberFormat(item.pkgSalePrice) }}</text>
  30. <text>x {{ item.orderNum }}</text>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="detail-info-content-money">
  35. <view class="detail-info-content-money__item">
  36. <text>商品金额</text>
  37. <text>¥{{ $numberFormat(info.orderAmt) }}</text>
  38. </view>
  39. <view class="detail-info-content-money__item">
  40. <text>运费</text>
  41. <text>¥{{ $numberFormat(info.freightAmt) }}</text>
  42. </view>
  43. </view>
  44. <view class="detail-info-content-toatl">
  45. <text v-if="status.value == 0">需付款:</text>
  46. <text v-else>实付:</text>
  47. <text>¥{{ $numberFormat(info.payAmt) }}</text>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="detail-info">
  52. <view class="detail-info-title">订单信息</view>
  53. <view class="detail-info-content">
  54. <view class="detail-info-content-desc">
  55. <view>收货信息:</view>
  56. <view>
  57. {{ info.receiver }},{{ info.tel }},{{ info.province }}{{ info.city }}{{ info.area }}{{ info.address }}
  58. </view>
  59. </view>
  60. <view class="detail-info-content-desc">
  61. <view>订单编号:</view>
  62. <view>{{ info.orderId }}</view>
  63. </view>
  64. <view class="detail-info-content-desc">
  65. <view>下单时间:</view>
  66. <view>{{ $parseTime(info.createdTime) }}</view>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="detail-info" v-if="status.value == 2">
  71. <view class="detail-info-title">发货信息</view>
  72. <view class="detail-info-content">
  73. <view class="detail-info-content-desc">
  74. <view>快递公司:</view>
  75. <view>快递123</view>
  76. </view>
  77. <view class="detail-info-content-desc">
  78. <view>物流单号:</view>
  79. <view>123456789</view>
  80. </view>
  81. <view class="detail-info-content-desc">
  82. <view>发货时间:</view>
  83. <view>2345-234-234</view>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="detail-btn" v-if="status.value == 0">
  89. <text @click="cancelOrder">取消订单</text>
  90. <text @click="payOrder">去支付</text>
  91. </view>
  92. </view>
  93. </template>
  94. <script>
  95. import env from '../../config/env.js'
  96. import $http from '@/utils/request.js'
  97. export default {
  98. data() {
  99. return {
  100. orderId: '',
  101. status: {},
  102. info: {},
  103. addr: {},
  104. list: [],
  105. };
  106. },
  107. onLoad(opthios) {
  108. this.orderId = opthios.id
  109. this.getDetail()
  110. },
  111. methods: {
  112. getDetail() {
  113. $http.post('/api/v1/mp/channel/mall/order/detail', {
  114. orderId: this.orderId
  115. }).then(res => {
  116. this.info = res.data
  117. this.status = JSON.parse(res.data.status)
  118. res.data.items.forEach(item => {
  119. let picUrlArr = item.picUrl.split(',')
  120. item.picUrl = env.filePublic + picUrlArr[0]
  121. })
  122. this.list = res.data.items
  123. })
  124. },
  125. cancelOrder() {
  126. $http.post('/api/v1/mp/channel/mall/order/cancel', {
  127. orderId: this.orderId
  128. }).then(res => {
  129. if (res.code == 0) {
  130. uni.$u.toast('订单取消成功');
  131. setTimeout(() => {
  132. uni.navigateBack({
  133. delta: 1
  134. })
  135. }, 1000)
  136. }
  137. })
  138. },
  139. payOrder() {
  140. },
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. /deep/ .u-navbar__content__title.u-navbar__content__title {
  146. color: #FFFFFF;
  147. }
  148. </style>
  149. <style lang="scss" scoped>
  150. .detail {
  151. margin: 10rpx;
  152. padding-bottom: 160rpx;
  153. &-state {
  154. padding: 28rpx;
  155. margin-bottom: 20rpx;
  156. background-color: #FFFFFF;
  157. &-title {
  158. line-height: 40rpx;
  159. font-weight: bold;
  160. }
  161. }
  162. &-info {
  163. margin-bottom: 20rpx;
  164. padding: 20rpx 28rpx;
  165. background-color: #FFFFFF;
  166. &-title {
  167. line-height: 40rpx;
  168. font-weight: bold;
  169. }
  170. &-content {
  171. &-goods {
  172. &__detail {
  173. padding: 20rpx 0;
  174. justify-content: space-between;
  175. border-bottom: 1px solid rgba(236, 236, 236, 100);
  176. &__left {
  177. display: flex;
  178. height: 170rpx;
  179. .img {
  180. image {
  181. width: 134rpx;
  182. height: 170rpx;
  183. margin-right: 20rpx;
  184. }
  185. }
  186. .info {
  187. display: flex;
  188. flex-direction: column;
  189. justify-content: space-between;
  190. text {
  191. font-size: 24rpx;
  192. color: #9D9D9D;
  193. }
  194. text:first-child {
  195. color: rgba(16, 16, 16, 100);
  196. font-size: 28rpx;
  197. }
  198. }
  199. }
  200. &__right {
  201. display: flex;
  202. height: 170rpx;
  203. flex-direction: column;
  204. justify-content: space-between;
  205. align-items: flex-end;
  206. text:first-child {
  207. font-size: 32rpx;
  208. color: $uni-text-color;
  209. }
  210. }
  211. }
  212. &__detail:last-child {
  213. border: none;
  214. }
  215. }
  216. &-money {
  217. margin-top: 40rpx;
  218. &__item {
  219. display: flex;
  220. align-items: center;
  221. justify-content: space-between;
  222. line-height: 40rpx;
  223. margin-bottom: 24rpx;
  224. }
  225. }
  226. &-toatl {
  227. padding-top: 24rpx;
  228. display: flex;
  229. align-items: center;
  230. justify-content: flex-end;
  231. font-weight: bold;
  232. }
  233. &-desc {
  234. display: flex;
  235. line-height: 40rpx;
  236. margin-top: 20rpx;
  237. margin-bottom: 24rpx;
  238. view:first-child {
  239. width: 150rpx;
  240. }
  241. view:last-child {
  242. width: calc(100% - 150rpx)
  243. }
  244. }
  245. &-desc:last-child {
  246. margin-bottom: 0;
  247. }
  248. }
  249. }
  250. }
  251. .detail-btn {
  252. display: flex;
  253. align-items: center;
  254. justify-content: flex-end;
  255. position: fixed;
  256. bottom: var(--window-bottom);
  257. left: 0;
  258. right: 0;
  259. // min-height: 120rpx;
  260. z-index: 11;
  261. box-shadow: 0 -4rpx 40rpx 0 rgba(151, 151, 151, 0.24);
  262. background: #fff;
  263. // margin-bottom: 40rpx;
  264. // 设置ios刘海屏底部横线安全区域
  265. padding-bottom: constant(safe-area-inset-bottom);
  266. padding-bottom: env(safe-area-inset-bottom);
  267. box-shadow: 0 -5rpx 5rpx #ececec;
  268. padding: 20rpx 20rpx;
  269. text {
  270. display: block;
  271. box-sizing: border-box;
  272. margin: 0 0 0 40rpx;
  273. width: 160rpx;
  274. height: 60rpx;
  275. line-height: 60rpx;
  276. text-align: center;
  277. font-size: 24rpx;
  278. border-radius: 8rpx;
  279. border: none;
  280. }
  281. text:first-child {
  282. background-color: #fff;
  283. line-height: 56rpx;
  284. border: 2rpx solid $uni-bg-color;
  285. }
  286. text:last-child {
  287. background-color: $uni-bg-color;
  288. color: #FFFFFF;
  289. }
  290. }
  291. </style>