table.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <scTable ref="table" :apiObj="list.apiObj" :params="searchKey" @selectionChange="selectionChange" row-key="id" @dataChange="getTotal">
  3. <el-table-column type="selection" width="50" fixed="left"></el-table-column>
  4. <el-table-column label="订单编号" width="200" prop="order_sn" fixed="left">
  5. <template #default="scope">
  6. {{scope.row.order_sn}}
  7. </template>
  8. </el-table-column>
  9. <el-table-column label="下单用户" prop="openid" width="240"></el-table-column>
  10. <el-table-column label="订单状态" prop="certificate_id" width="120">
  11. <template #default="scope">
  12. {{ status[scope.row.status] }}
  13. </template>
  14. </el-table-column>
  15. <el-table-column label="订单金额" prop="money" width="120">
  16. <template #default="scope">
  17. <div class="price" v-if="scope.row.money > scope.row.discount">
  18. <el-tag>{{ $TOOL.money(scope.row.discount) }}</el-tag>
  19. <div class="del">{{ $TOOL.money(scope.row.money) }}</div>
  20. </div>
  21. <div class="price" v-else>
  22. <el-tag>{{ $TOOL.money(scope.row.money) }}</el-tag>
  23. </div>
  24. </template>
  25. </el-table-column>
  26. <el-table-column label="额外加价" prop="money" width="120">
  27. <template #default="scope">
  28. {{ $TOOL.money(scope.row.extra_money) }}
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="支付方式" prop="money">
  32. <template #default="scope">
  33. <el-tag>{{ payStatus[scope.row.pay_type] }}</el-tag>
  34. </template>
  35. </el-table-column>
  36. <el-table-column label="打印机" prop="money" width="180">
  37. <template #default="scope">
  38. {{ scope.row.print_name }}
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="取件方式" prop="money" width="120">
  42. <template #default="scope">
  43. {{ ostatus[scope.row.package] }}
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="取件号" prop="package_sn" width="120"></el-table-column>
  47. <el-table-column label="失败原因" prop="money" width="180">
  48. <template #default="scope">
  49. {{ scope.row.reason?scope.row.reason:'-' }}
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="支付时间" prop="pay_at" width="180">
  53. <template #default="scope">
  54. {{ scope.row.pay_at?scope.row.pay_at:'-' }}
  55. </template>
  56. </el-table-column>
  57. <el-table-column label="打印时间" prop="pay_at" width="180">
  58. <template #default="scope">
  59. {{ scope.row.print_at?scope.row.print_at:'-' }}
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="创建时间" prop="create_at" width="180">
  63. <template #default="scope">
  64. {{ scope.row.create_at }}
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="操作" width="160" align="right" fixed="right">
  68. <template #default="scope">
  69. <el-button-group>
  70. <el-button text type="warning" size="small" @click="table_edit(scope.row)">详情</el-button>
  71. <el-button text type="danger" size="small" @click="table_del(scope.row, scope.$index)">退款</el-button>
  72. <!-- <el-popconfirm title="确定要退款吗?" @confirm="table_del(scope.row, scope.$index)" v-if="scope.row.status > 0">
  73. <template #reference>
  74. <el-button text type="danger" size="small">退款</el-button>
  75. </template>
  76. </el-popconfirm> -->
  77. </el-button-group>
  78. </template>
  79. </el-table-column>
  80. </scTable>
  81. <formMain ref="formMain" @success="handleSuccess"></formMain>
  82. <refundMain ref="refundMain" @success="handleSuccess"></refundMain>
  83. </template>
  84. <script>
  85. import formMain from "./detail";
  86. import refundMain from "./refund";
  87. export default {
  88. components: {
  89. formMain,refundMain
  90. },
  91. props: {
  92. type: { type: String, default: "1" }
  93. },
  94. data(){
  95. return {
  96. colorData:['','彩色','黑白'],
  97. duplexData:['','单面','双面'],
  98. list: {
  99. apiObj: this.$API.mOrder.list
  100. },
  101. status: ['待支付','待打印', '打印失败', '已打印','申请退款','退款失败','已退款'],
  102. ostatus: ['-','店内打印', '远程自取', '商家配送'],
  103. payStatus:['-','微信','会员卡'],
  104. visible:false,
  105. dataSelect:[],
  106. dataSelectFull:[],
  107. searchKey:{}
  108. }
  109. },
  110. methods:{
  111. async getTotal(){
  112. var resp = await this.$API.mOrder.total.get(this.searchKey);
  113. if (resp.code == 1) {
  114. this.$emit("total",resp.data.total,this.searchKey);
  115. }
  116. },
  117. table_edit(data){
  118. this.$nextTick(() => {
  119. this.$refs.formMain.open("edit",this.type).setData(data)
  120. })
  121. },
  122. table_del(data){
  123. this.$nextTick(() => {
  124. this.$refs.refundMain.open("edit").setData(data)
  125. })
  126. // this.$confirm("确定要对整笔订单进行退款吗","退款确认",{type: 'warning'}).then(async ()=>{
  127. // var resp = await this.$API.mOrder.refund.post({"id":data.id});
  128. // if (resp.code == 0) {
  129. // return this.$message.error(resp.msg)
  130. // }
  131. // this.$message.success(resp.msg)
  132. // this.$refs.table.refresh()
  133. // }).catch(()=>{});
  134. },
  135. refresh(){
  136. this.$refs.table.refresh()
  137. },
  138. upData(data){
  139. this.$refs.table.upData(data)
  140. },
  141. handleSuccess(){
  142. this.$refs.table.refresh()
  143. },
  144. }
  145. }
  146. </script>
  147. <style>
  148. .price{display: flex;align-items: center;}
  149. .del{text-decoration: line-through;margin-left: 5px;color: #f00;}
  150. </style>