orderDetail.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <!-- #ifdef H5 -->
  3. <view class="all-container">
  4. <view class="bg"></view>
  5. <Loading :type="3" :loadStatus="loadStatus" :showText="errorText" />
  6. <zj-page-layout
  7. v-if="detail"
  8. :hasFooter="true"
  9. :isScroll="true"
  10. :refresherTriggered="refresherTriggered"
  11. @refresherrefresh="refresherrefresh"
  12. >
  13. <view class="content-container">
  14. <view class="status-container">{{ detail.payStatus | statusFilter }}</view>
  15. <view class="product-container card">
  16. <view class="title">产品信息</view>
  17. <view class="product">
  18. <view class="it" v-for="(item, index) in detail.workerOrderItems" :key="index">
  19. <view class="name"
  20. >({{ { INNER: '保内', OUTSIDE: '保外' }[item.repairFlag] }}){{ item.goodsName
  21. }}<text>×{{ item.num }}{{ item.unit }}</text></view
  22. >
  23. <view class="price">¥{{ item.totalAmount | priceFilter }}</view>
  24. </view>
  25. <view class="total">
  26. <view class="text">合计:</view>
  27. <view class="price">¥{{ detail.totalAmount | priceFilter }}</view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="info-container card">
  32. <view class="title">下单信息</view>
  33. <view class="row">
  34. <view class="label">订单单号</view>
  35. <view class="value">{{ detail.orderId }}</view>
  36. <view class="tag" @tap="$copy(detail.orderId)">复制</view>
  37. </view>
  38. <view class="row">
  39. <view class="label">关联工单</view>
  40. <view class="value">{{ detail.workerOrderId }}</view>
  41. <view class="tag" @tap="$copy(detail.workerOrderId)">复制</view>
  42. </view>
  43. <view class="row">
  44. <view class="label">客户电话</view>
  45. <view class="value">{{ detail.userMobile }}</view>
  46. </view>
  47. <!-- <view class="row">
  48. <view class="label">销售方式</view>
  49. <view class="value">{{ detail.settlementType | salesTypeFilter }}</view>
  50. </view> -->
  51. <view class="row">
  52. <view class="label">所属网点</view>
  53. <view class="value">{{ detail.websitName }}</view>
  54. </view>
  55. <view class="row">
  56. <view class="label">下单人员</view>
  57. <view class="value">{{ detail.workerName }}</view>
  58. </view>
  59. <view class="row">
  60. <view class="label">下单时间</view>
  61. <view class="value">{{ detail.createTime }}</view>
  62. </view>
  63. <view class="row">
  64. <view class="label">支付方式</view>
  65. <view class="value">{{ detail.payType | payTypeFilter }}</view>
  66. </view>
  67. <view class="row">
  68. <view class="label">备注信息</view>
  69. <view class="value">{{ detail.remark }}</view>
  70. </view>
  71. </view>
  72. </view>
  73. <template slot="footer">
  74. <view class="bottom-container" v-if="detail.payStatus == 'WAIT'">
  75. <view class="left"></view>
  76. <view class="right">
  77. <u-button text="取消订单" @click="cancelOrder"></u-button>
  78. </view>
  79. </view>
  80. </template>
  81. </zj-page-layout>
  82. </view>
  83. <!-- #endif -->
  84. <!-- #ifndef H5 -->
  85. <web-view
  86. :src="webViewHref(`/packageMaterial/pages/newSale/orderDetail`, pam, crossPagePam)"
  87. @message="crossPage.$listener"
  88. ></web-view>
  89. <!-- #endif -->
  90. </template>
  91. <script>
  92. // #ifdef H5
  93. export default {
  94. filters: {
  95. statusFilter(val) {
  96. const MAP = {
  97. WAIT: '待支付',
  98. PAID: '已支付',
  99. CANCEL: '已取消',
  100. }
  101. return MAP[val];
  102. },
  103. salesTypeFilter(val) {
  104. const MAP = {
  105. OWN: '自有出库',
  106. OUT: '外购销售',
  107. }
  108. return MAP[val];
  109. },
  110. payTypeFilter(val) {
  111. const MAP = {
  112. WECHAT: '微信支付',
  113. LINE: '线下支付',
  114. }
  115. return MAP[val];
  116. }
  117. },
  118. data() {
  119. return {
  120. id: null,
  121. refresherTriggered: false,
  122. loadStatus: 0,
  123. errorText: '',
  124. detail: null,
  125. }
  126. },
  127. onLoad({id}) {
  128. this.id = id;
  129. this.getDetail();
  130. },
  131. methods: {
  132. getDetail() {
  133. this.$api.post('/pay/getOrder', {
  134. orderId: this.id
  135. }).then(res => {
  136. this.detail = res.data;
  137. this.loadStatus = 0;
  138. }).catch(res => {
  139. this.errorText = res.message;
  140. this.loadStatus = 2;
  141. }).finally(res => {
  142. this.refresherTriggered = false;
  143. })
  144. },
  145. // 下拉刷新
  146. refresherrefresh() {
  147. this.refresherTriggered = true;
  148. this.getDetail();
  149. },
  150. // 取消订单
  151. cancelOrder() {
  152. this.$modal({
  153. content: '确认取消订单吗?'
  154. }).then(() => {
  155. this.$api.post('/pay/cancel', {
  156. orderId: this.id
  157. }).then(res => {
  158. this.$successToast();
  159. this.getDetail();
  160. })
  161. }).catch(() => {})
  162. }
  163. },
  164. }
  165. // #endif
  166. // #ifndef H5
  167. export default {
  168. data() {
  169. return {
  170. pam: {},
  171. }
  172. },
  173. onLoad(pam) {
  174. this.pam = pam;
  175. }
  176. }
  177. // #endif
  178. </script>
  179. <style lang="scss" scoped>
  180. .all-container {
  181. position: relative;
  182. }
  183. .bg {
  184. position: absolute;
  185. top: 0;
  186. left: 0;
  187. width: 100%;
  188. height: 300rpx;
  189. background: linear-gradient(179.48deg, rgba(200, 224, 251, 1) 0.45%, rgba(247, 247, 247, 1) 98.96%);
  190. }
  191. .card {
  192. @include zj-card;
  193. margin-top: 30rpx;
  194. padding: 30rpx;
  195. .title {
  196. font-size: 32rpx;
  197. font-weight: 600;
  198. }
  199. }
  200. .content-container {
  201. padding: 20rpx;
  202. }
  203. .status-container {
  204. font-size: 36rpx;
  205. font-weight: 500;
  206. margin-left: 30rpx;
  207. text {
  208. margin-left: 12rpx;
  209. }
  210. }
  211. .product-container {
  212. .title {
  213. display: flex;
  214. align-items: center;
  215. justify-content: space-between;
  216. .left {
  217. font-size: 32rpx;
  218. font-weight: 600;
  219. }
  220. .right {
  221. font-size: 28rpx;
  222. color: $theme-color;
  223. }
  224. }
  225. .product {
  226. background: #f5f5f5;
  227. border-radius: 12rpx;
  228. padding: 20rpx;
  229. margin-top: 20rpx;
  230. .it {
  231. display: flex;
  232. align-items: flex-end;
  233. margin-bottom: 20rpx;
  234. .name {
  235. flex: 1;
  236. font-size: 28rpx;
  237. font-weight: 500;
  238. text {
  239. color: $sec-font;
  240. margin-left: 12rpx;
  241. font-weight: normal;
  242. }
  243. }
  244. .price {
  245. margin-left: 30rpx;
  246. font-size: 28rpx;
  247. font-weight: 500;
  248. }
  249. }
  250. .total {
  251. display: flex;
  252. align-items: center;
  253. justify-content: flex-end;
  254. margin-top: 30rpx;
  255. .text {
  256. font-size: 28rpx;
  257. color: $sec-font;
  258. }
  259. .price {
  260. font-size: 28rpx;
  261. color: $minor-color;
  262. font-weight: 500;
  263. }
  264. }
  265. }
  266. }
  267. .info-container {
  268. .row {
  269. display: flex;
  270. align-items: center;
  271. margin-top: 20rpx;
  272. .label {
  273. font-size: 28rpx;
  274. color: $sec-font;
  275. margin-right: 20rpx;
  276. }
  277. .value {
  278. flex: 1;
  279. font-size: 28rpx;
  280. text {
  281. color: $minor-color;
  282. }
  283. &.price {
  284. color: $theme-color;
  285. }
  286. }
  287. .tag {
  288. font-size: 28rpx;
  289. color: $theme-color;
  290. }
  291. }
  292. }
  293. .bottom-container {
  294. padding: 20rpx;
  295. display: flex;
  296. justify-content: space-between;
  297. .right {
  298. display: flex;
  299. ::v-deep .u-button {
  300. margin-left: 20rpx;
  301. }
  302. }
  303. }
  304. </style>