RelatedOrders.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <el-dialog :visible.sync="visible" v-bind="modalOptions" append-to-body>
  3. <div>
  4. <div style="display: flex; justify-content: flex-end;margin-bottom: 15px;">
  5. <el-button type="success" @click="exportRelatedOrders">导出关联订单数据</el-button>
  6. </div>
  7. <el-table
  8. v-loading="!formData.relatedOrders[orderSn]" height="60vh" element-loading-text="暂无关联订单数据"
  9. :data="formData.relatedOrders[orderSn]"
  10. v-bind="{ stripe: true, size: 'small', border: true, fit: true, highlightCurrentRow: true }"
  11. >
  12. <el-table-column align="center" min-width="80" prop="orderId" label="订单ID" show-overflow-tooltip />
  13. <el-table-column align="center" min-width="150" prop="orderFormid" label="订单编号" show-overflow-tooltip />
  14. <el-table-column align="center" min-width="150" prop="createTime" label="创建时间" show-overflow-tooltip />
  15. <el-table-column align="center" width="150" prop="cerePayLog.transactionId" label="三方交易流水号" show-overflow-tooltip />
  16. <el-table-column align="center" min-width="120" label="订单状态" prop="state">
  17. <template slot-scope="{ row }">
  18. <span v-if="row.state === 1">待付款</span>
  19. <span v-else-if="row.state === 2">待发货</span>
  20. <span v-else-if="row.state === 3">待收货</span>
  21. <span v-else-if="row.state === 4">已完成</span>
  22. <span v-else-if="row.state === 5">交易关闭(已取消)</span>
  23. <span v-else-if="row.state === 6">待成团</span>
  24. <span v-else-if="row.state === 7">待售后</span>
  25. <span v-else-if="row.state === 8">待核销(未付款)</span>
  26. <span v-else-if="row.state === 9">待核销(已付款)</span>
  27. <span v-else-if="row.state === 10">已核销</span>
  28. <span v-else>--</span>
  29. </template>
  30. </el-table-column>
  31. <el-table-column align="center" min-width="100" prop="orderPrice" label="商品总价" show-overflow-tooltip />
  32. <el-table-column align="center" min-width="100" prop="price" label="支付金额" show-overflow-tooltip />
  33. <el-table-column align="center" min-width="120" label="支付方式" prop="paymentMode">
  34. <template slot-scope="{ row }">
  35. <span v-if="row.paymentMode === 1">微信</span>
  36. <span v-else-if="row.paymentMode === 2">支付宝</span>
  37. <span v-else-if="row.paymentMode === 3">花呗分期</span>
  38. <span v-else-if="row.paymentMode === 4">通联支付</span>
  39. <span v-else-if="row.paymentMode === 5">平台余额支付</span>
  40. <span v-else-if="row.paymentMode === 6">商家余额支付</span>
  41. <span v-else-if="row.paymentMode === 7">佣金支付</span>
  42. <span v-else-if="row.paymentMode === 8">消费金支付</span>
  43. <span v-else-if="row.paymentMode === 9">惠市宝支付</span>
  44. <span v-else>--</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column align="center" min-width="100" label="是否支付" prop="paymentState">
  48. <template slot-scope="{ row }">
  49. <el-tag v-if="row.paymentState === 0" effect="plain" type="info">否</el-tag>
  50. <el-tag v-else-if="row.paymentState === 1" effect="plain" type="success">是</el-tag>
  51. <span v-else>--</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column align="center" min-width="150" prop="paymentTime" label="支付时间" show-overflow-tooltip />
  55. <el-table-column align="center" min-width="100" prop="logisticsPrice" label="物流费用" show-overflow-tooltip />
  56. <el-table-column align="center" min-width="100" label="售后状态" prop="afterState">
  57. <template slot-scope="{ row }">
  58. <span v-if="row.afterState === -1">无退货</span>
  59. <span v-else-if="row.afterState === 1">审核中</span>
  60. <span v-else-if="row.afterState === 2">退款中</span>
  61. <span v-else-if="row.afterState === 3">退货中</span>
  62. <span v-else-if="row.afterState === 4">退款完成</span>
  63. <span v-else-if="row.afterState === 5">退款失败</span>
  64. <span v-else-if="row.afterState === 6">审核不通过</span>
  65. <span v-else-if="row.afterState === 7">评审中</span>
  66. <span v-else-if="row.afterState === 8">退货完成,拒绝退款</span>
  67. <span v-else-if="row.afterState === 9">撤销申请</span>
  68. <span v-else-if="row.afterState === 10">审核通过</span>
  69. <span v-else>--</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column align="center" min-width="120" label="客户ID" prop="buyerUserId">
  73. <template slot-scope="{ row }">
  74. <div>
  75. <span>{{ row.buyerUserId }}</span>
  76. <el-button
  77. v-if="formData.relatedBuyerUsers.find((item) => item.buyerUserId === row.buyerUserId)"
  78. style="margin-left: 14px;"
  79. type="warning" size="mini"
  80. @click="handleOpenUserDetails(row.buyerUserId)"
  81. >
  82. 详情
  83. </el-button>
  84. </div>
  85. </template>
  86. </el-table-column>
  87. <el-table-column align="center" min-width="100" prop="customerName" label="下单账户" show-overflow-tooltip />
  88. <el-table-column align="center" min-width="120" prop="customerPhone" label="下单账户手机号" show-overflow-tooltip />
  89. <el-table-column align="center" min-width="150" prop="receiveAdress" label="收货人地址" show-overflow-tooltip />
  90. <el-table-column align="center" min-width="100" prop="receiveName" label="收货人姓名" show-overflow-tooltip />
  91. <el-table-column align="center" min-width="150" prop="receivePhone" label="收货人手机号" show-overflow-tooltip />
  92. <el-table-column align="center" min-width="150" prop="address" label="详细地址" show-overflow-tooltip />
  93. <el-table-column align="center" min-width="120" prop="shopId" label="关联店铺ID" show-overflow-tooltip />
  94. <el-table-column align="center" label="操作" width="100" fixed="right" class-name="small-padding fixed-width">
  95. <template slot-scope="{ row }">
  96. <!-- <el-button
  97. v-if="formData.relatedPresenterVoucherLogs[row.orderFormid]" type="success" size="mini"
  98. @click="$refs.OrderCommission && $refs.OrderCommission.handleOpen(row)"
  99. >
  100. 查看分佣
  101. </el-button> -->
  102. <el-button
  103. v-if="formData.relatedPresenterVoucherLogs[row.orderFormid]" type="success" size="mini"
  104. @click="$refs.RelatedVoucherLogs && $refs.RelatedVoucherLogs.handleOpen(formData.relatedPresenterVoucherLogs[row.orderFormid], { userList: formData.relatedBuyerUsers })"
  105. >
  106. 代金券记录
  107. </el-button>
  108. <!-- <el-button
  109. v-if="formData.relatedCommissionLogs[row.orderFormid]" type="success" size="mini"
  110. @click="$refs.RelatedCommissionLogs && $refs.RelatedCommissionLogs.handleOpen(formData.relatedCommissionLogs[row.orderFormid], { userList: formData.relatedBuyerUsers })"
  111. >
  112. 佣金记录
  113. </el-button> -->
  114. </template>
  115. </el-table-column>
  116. </el-table>
  117. <!-- 订单分佣 -->
  118. <OrderCommission ref="OrderCommission" />
  119. <!-- 代金券记录 -->
  120. <RelatedVoucherLogs ref="RelatedVoucherLogs" />
  121. <!-- 佣金记录 -->
  122. <RelatedCommissionLogs ref="RelatedCommissionLogs" />
  123. <!-- 用户详情 -->
  124. <UserDetails ref="UserDetails" />
  125. </div>
  126. <template #footer>
  127. <span class="dialog-footer">
  128. <el-button size="mini" @click="handleClose">关 闭</el-button>
  129. </span>
  130. </template>
  131. </el-dialog>
  132. </template>
  133. <script>
  134. import { exportWithdrawal } from '@/api/withdrawal'
  135. import OrderCommission from './OrderCommission'
  136. import RelatedVoucherLogs from './RelatedVoucherLogs'
  137. import RelatedCommissionLogs from './RelatedCommissionLogs'
  138. import UserDetails from './UserDetails'
  139. export default {
  140. name: 'RelatedOrders',
  141. props: {
  142. orderInfo: {
  143. type: Object,
  144. default: () => ({})
  145. }
  146. },
  147. components: {
  148. OrderCommission,
  149. RelatedVoucherLogs,
  150. RelatedCommissionLogs,
  151. UserDetails
  152. },
  153. data() {
  154. return {
  155. modalOptions: {
  156. closeOnClickModal: false,
  157. width: '1120px',
  158. title: '关联订单'
  159. },
  160. visible: false,
  161. formData: {
  162. relatedSettlement: [],
  163. relatedOrders: {},
  164. relatedPresenterVoucherLogs: {},
  165. relatedCommissionLogs: {},
  166. relatedBuyerUsers: []
  167. },
  168. orderSn: ''
  169. }
  170. },
  171. methods: {
  172. // 下载关联订单列表
  173. async exportRelatedOrders() {
  174. console.log(this.orderInfo)
  175. this.$message({
  176. message: '数据导出中,请勿重复操作!',
  177. type: 'success'
  178. })
  179. const res = await exportWithdrawal({page:1,pageSize:1,withdrawalId: this.orderInfo.withdrawalId})
  180. if (!res) {
  181. return
  182. }
  183. this.xlsDownload(res,`${this.orderInfo.shopName}关联订单.xls`)
  184. },
  185. // 封装下载函数
  186. xlsDownload(res,name){
  187. const blob = new Blob([ res ], { type: 'application/vnd.ms-excel' })
  188. const fileName = name
  189. if ('download' in document.createElement('a')) {
  190. // 非IE下载
  191. const elink = document.createElement('a')
  192. elink.download = fileName
  193. elink.style.display = 'none'
  194. elink.href = URL.createObjectURL(blob)
  195. document.body.appendChild(elink)
  196. elink.click()
  197. URL.revokeObjectURL(elink.href) // 释放URL 对象
  198. document.body.removeChild(elink)
  199. } else {
  200. // IE10+下载
  201. navigator.msSaveBlob(blob, fileName)
  202. }
  203. },
  204. handleClose() {
  205. this.visible = false
  206. },
  207. handleOpen(params = {}, orderSn) {
  208. console.log(params)
  209. this.formData = Object.assign(this.$options.data().formData, params)
  210. this.orderSn = orderSn
  211. this.visible = true
  212. this.$forceUpdate()
  213. // this.$refs.formData && this.$refs.formData.resetFields()
  214. },
  215. handleOpenUserDetails(buyerUserId) {
  216. const userMsg = this.formData.relatedBuyerUsers.find((item) => item.buyerUserId === buyerUserId)
  217. if (userMsg) {
  218. this.$refs.UserDetails && this.$refs.UserDetails.handleOpen(userMsg)
  219. }
  220. },
  221. handleSubmit() {
  222. }
  223. }
  224. }
  225. </script>
  226. <style lang="scss" scoped>
  227. .small-padding {
  228. .cell {
  229. padding-left: 5px;
  230. padding-right: 5px;
  231. }
  232. }
  233. .fixed-width {
  234. .el-button--mini {
  235. padding: 7px 10px;
  236. }
  237. }
  238. </style>