buy-order-item.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <view class="buy-order-item" @click="goToDetail">
  3. <!-- 订单头部:订单号和状态 -->
  4. <view class="order-header">
  5. <text class="order-no">订单号:{{ order.orderId }}</text>
  6. <text class="order-status">{{ getStatusText(order) }}</text>
  7. </view>
  8. <!-- 商品信息 -->
  9. <view class="goods-list">
  10. <scroll-view scroll-x class="goods-scroll" v-if="order.detailCoverList && order.detailCoverList.length > 0">
  11. <view class="goods-wrapper">
  12. <image v-for="(cover, index) in order.detailCoverList" :key="index" :src="cover || defaultCover"
  13. mode="aspectFill" class="goods-cover"></image>
  14. </view>
  15. </scroll-view>
  16. <!-- 单本书样式 -->
  17. <view class="single-book" v-else>
  18. <image :src="order.bookCover || defaultCover" mode="aspectFit" class="book-cover"></image>
  19. <view class="book-info">
  20. <view class="info-top">
  21. <text class="book-name u-line-2">{{ order.bookName }}</text>
  22. <view class="price-box">
  23. <text class="price">¥ {{ order.bookPrice || '0.00' }}</text>
  24. <text class="num">x{{ order.bookNum }}</text>
  25. </view>
  26. </view>
  27. <view class="book-sku" v-if="order.bookConditionType">
  28. 品相:{{ order.bookConditionType | conditionText }}
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 价格汇总 -->
  34. <view class="order-total">
  35. <text class="ml-20">总价 ¥{{ order.totalMoney || 0 }}</text>
  36. <text class="ml-20">实付款 ¥{{ order.payMoney || 0 }}</text>
  37. </view>
  38. <!-- 操作按钮 -->
  39. <view class="action-box">
  40. <!-- 付款 (未包含在Flags中,保留原逻辑: 待付款且未取消) -->
  41. <u-button v-if="order.status == '1' && order.cancelStatus == '0'" size="mini" shape="circle"
  42. :custom-style="themeBtnStyle" @click.stop="handleAction('pay')">付款</u-button>
  43. <!-- 确认收货 -->
  44. <u-button v-if="order.showConfirmShop == 1" size="mini" shape="circle" :custom-style="themeBtnStyle"
  45. @click.stop="handleAction('confirm')">确认收货</u-button>
  46. <!-- 加入购物车 -->
  47. <u-button v-if="order.showAddToCart == 1" size="mini" shape="circle" :custom-style="themeBtnStyle"
  48. @click.stop="handleAction('addToCart')">加入购物车</u-button>
  49. <!-- 再来一单 -->
  50. <u-button v-if="order.showBuyAgain == 1" size="mini" shape="circle" type="primary" plain
  51. :custom-style="btnStyle" @click.stop="handleAction('rebuy')">再买一单</u-button>
  52. <!-- 评价 -->
  53. <u-button v-if="order.showEvaluation == 1" size="mini" shape="circle" type="primary" plain
  54. :custom-style="btnStyle" @click.stop="handleAction('evaluate')">评价</u-button>
  55. <!-- 查看物流 -->
  56. <u-button v-if="order.showCheckExpress == 1 && order.status != '4'" size="mini" shape="circle"
  57. type="primary" plain :custom-style="btnStyle" @click.stop="handleAction('logistics')">查看物流</u-button>
  58. <!-- 延长收货 -->
  59. <u-button v-if="order.showExtendReceivingTime == 1" size="mini" shape="circle" plain
  60. :custom-style="btnStyle" @click.stop="handleAction('extend')">延长收货</u-button>
  61. <!-- 催发货 -->
  62. <u-button v-if="order.showUrge == 1" size="mini" shape="circle" type="warning" plain
  63. :custom-style="btnStyle" @click.stop="handleAction('remind')">催发货</u-button>
  64. <!-- 更多操作 (仅在已完成状态下显示) -->
  65. <u-button
  66. v-if="order.status == '4' && (order.showAfterSales == 1 || order.showCheckExpress == 1 || order.showApplyInvoice == 1)"
  67. size="mini" shape="circle" plain :custom-style="btnStyle"
  68. @click.stop="handleMoreAction">更多</u-button>
  69. <!-- 申请售后 -->
  70. <u-button v-if="order.showAfterSales == 1 && order.status != '4'" size="mini" shape="circle" type="error"
  71. plain :custom-style="btnStyle" @click.stop="handleAction('refund')">申请售后</u-button>
  72. <!-- 取消订单 (未包含在Flags中,保留原逻辑: 待付款且未取消) -->
  73. <u-button v-if="order.status == '1' && order.cancelStatus == '0'" size="mini" shape="circle" type="error"
  74. plain :custom-style="btnStyle" @click.stop="handleAction('cancel')">取消订单</u-button>
  75. <!-- 删除订单 (未包含在Flags中,保留原逻辑) -->
  76. <u-button v-if="order.cancelStatus == '1'" size="mini" shape="circle" type="error" plain
  77. :custom-style="btnStyle" @click.stop="handleAction('delete')">删除订单</u-button>
  78. <!-- 钱款去向 -->
  79. <u-button v-if="order.showMoneyDestination == 1" size="mini" shape="circle" type="primary" plain
  80. :custom-style="btnStyle" @click.stop="handleAction('moneyWhere')">钱款去向</u-button>
  81. <!-- 查看详情 -->
  82. <u-button v-if="order.showShowDetail == 1" size="mini" shape="circle" plain
  83. :custom-style="btnStyle" @click.stop="handleAction('detail')">查看详情</u-button>
  84. <!-- 申请开票 -->
  85. <u-button v-if="order.showApplyInvoice == 1 && order.status != '4'" size="mini" shape="circle" plain
  86. :custom-style="btnStyle" @click.stop="handleAction('invoice')">申请开票</u-button>
  87. <!-- 投诉 -->
  88. <u-button v-if="order.showComplaint == 1" size="mini" shape="circle" plain :custom-style="btnStyle"
  89. @click.stop="handleAction('complaint')">投诉</u-button>
  90. <!-- 修改地址 -->
  91. <u-button v-if="order.showModifyAddress == 1" size="mini" shape="circle" plain :custom-style="btnStyle"
  92. @click.stop="handleAction('address')">修改地址</u-button>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. export default {
  98. props: {
  99. order: {
  100. type: Object,
  101. required: true
  102. }
  103. },
  104. data() {
  105. return {
  106. defaultCover: 'https://uviewui.com/album/1.jpg',
  107. btnStyle: {
  108. marginLeft: '20rpx',
  109. height: '60rpx',
  110. lineHeight: '60rpx',
  111. padding: '0 24rpx',
  112. fontSize: '26rpx',
  113. },
  114. themeBtnStyle: {
  115. marginLeft: '20rpx',
  116. height: '60rpx',
  117. lineHeight: '60rpx',
  118. padding: '0 30rpx',
  119. backgroundColor: '#38C148',
  120. color: '#fff',
  121. fontSize: '26rpx',
  122. }
  123. }
  124. },
  125. methods: {
  126. goToDetail() {
  127. uni.navigateTo({
  128. url: `/pages-car/pages/order-detail?orderId=${this.order.orderId}`
  129. })
  130. },
  131. getStatusText(order) {
  132. if (order.cancelStatus == '1') return '已取消';
  133. if (order.refundStatus == '2') return '退款中';
  134. if (order.refundStatus == '3') return '已退款';
  135. const map = {
  136. '1': '待付款',
  137. '2': '待发货',
  138. '3': '待收货',
  139. '4': '已完成'
  140. }
  141. return map[order.status] || '未知状态'
  142. },
  143. handleAction(type, data) {
  144. if (type === 'complaint') {
  145. uni.setStorageSync('tempComplaintOrder', this.order);
  146. uni.navigateTo({
  147. url: `/pages-car/pages/complaint?orderId=${this.order.orderId}`
  148. });
  149. return;
  150. }
  151. if (type === 'detail') {
  152. // 跳转至退款详情页
  153. const id = this.order.refundOrderId;
  154. uni.navigateTo({
  155. url: `/pages-car/pages/refund-detail?refundOrderId=${id}`
  156. });
  157. return;
  158. }
  159. this.$emit('action', { type, order: this.order, data })
  160. },
  161. handleMoreAction() {
  162. // 收集更多按钮下的操作
  163. const actions = [];
  164. if (this.order.showAfterSales == 1) actions.push('applyAfterSales');
  165. if (this.order.showCheckExpress == 1) actions.push('logistics');
  166. if (this.order.showApplyInvoice == 1) actions.push('invoice');
  167. this.$emit('action', { type: 'more', order: this.order, data: actions });
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. .buy-order-item {
  174. background-color: #fff;
  175. border-radius: 16rpx;
  176. padding: 30rpx 20rpx;
  177. margin-bottom: 20rpx;
  178. .order-header {
  179. display: flex;
  180. justify-content: space-between;
  181. margin-bottom: 20rpx;
  182. font-size: 28rpx;
  183. .order-no {
  184. color: #333;
  185. font-weight: 500;
  186. }
  187. .order-status {
  188. color: #999;
  189. }
  190. }
  191. .goods-list {
  192. margin-bottom: 20rpx;
  193. .goods-scroll {
  194. white-space: nowrap;
  195. width: 100%;
  196. .goods-wrapper {
  197. display: flex;
  198. }
  199. .goods-cover {
  200. width: 140rpx;
  201. height: 140rpx;
  202. margin-right: 20rpx;
  203. border-radius: 8rpx;
  204. flex-shrink: 0;
  205. }
  206. }
  207. .single-book {
  208. display: flex;
  209. .book-cover {
  210. width: 140rpx;
  211. height: 140rpx;
  212. margin-right: 10rpx;
  213. border-radius: 8rpx;
  214. flex-shrink: 0;
  215. }
  216. .book-info {
  217. flex: 1;
  218. display: flex;
  219. flex-direction: column;
  220. justify-content: space-between;
  221. .info-top {
  222. display: flex;
  223. justify-content: space-between;
  224. .book-name {
  225. flex: 1;
  226. font-size: 28rpx;
  227. color: #333;
  228. font-weight: bold;
  229. margin-right: 30rpx;
  230. }
  231. .price-box {
  232. text-align: right;
  233. display: flex;
  234. flex-direction: column;
  235. align-items: flex-end;
  236. .price {
  237. font-size: 28rpx;
  238. color: #333;
  239. font-weight: 500;
  240. }
  241. .num {
  242. font-size: 24rpx;
  243. color: #999;
  244. margin-top: 6rpx;
  245. }
  246. }
  247. }
  248. .book-sku {
  249. background: rgb(56, 193, 72, 0.1);
  250. color: #333;
  251. font-size: 24rpx;
  252. padding: 4rpx 12rpx;
  253. border-radius: 4rpx;
  254. align-self: flex-start;
  255. margin-top: 10rpx;
  256. }
  257. }
  258. }
  259. }
  260. .order-total {
  261. text-align: right;
  262. font-size: 26rpx;
  263. color: #333;
  264. margin-bottom: 20rpx;
  265. .ml-20 {
  266. margin-left: 20rpx;
  267. font-weight: 500;
  268. }
  269. }
  270. .action-box {
  271. display: flex;
  272. justify-content: flex-end;
  273. align-items: center;
  274. flex-wrap: wrap; // 防止按钮过多换行问题
  275. u-button {
  276. margin-bottom: 10rpx; // 如果换行,增加间距
  277. }
  278. .status-desc {
  279. font-size: 26rpx;
  280. color: #999;
  281. }
  282. }
  283. }
  284. </style>