table.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <scTable ref="table" :apiObj="list.apiObj" :params="searchKey" @selectionChange="selectionChange" row-key="id" :row-class-name="tableRowClassName">
  3. <el-table-column type="selection" width="50" fixed="left"></el-table-column>
  4. <el-table-column label="订单编号" width="260" fixed="left" prop="goods_id">
  5. <template #default="scope">
  6. <div class="order-name">
  7. <span>{{ scope.row.order_sn }}</span>
  8. <span class="dec">系统单号:{{ scope.row.out_order_no }}</span>
  9. </div>
  10. </template>
  11. </el-table-column>
  12. <el-table-column label="商品类型" prop="types" width="100">
  13. <template #default="scope">
  14. {{ scope.row.product?scope.row.product.types:'-' }}
  15. </template>
  16. </el-table-column>
  17. <el-table-column label="商品信息" width="340" prop="name">
  18. <template #default="scope">
  19. <div class="goods-img">
  20. <div class="img">
  21. <el-image
  22. style="width: 54px; height: 54px"
  23. :src="scope.row.img"
  24. :zoom-rate="1.2"
  25. :max-scale="7"
  26. :min-scale="0.2"
  27. :preview-src-list="[scope.row.img]"
  28. preview-teleported
  29. z-index="999"
  30. fit="cover"></el-image>
  31. </div>
  32. <div class="name">
  33. <template v-if="scope.row.product">
  34. <span v-if="scope.row.product.is_new == 1">{{scope.row.product.price}}元代{{scope.row.product.line_price}}元商场权益券{{ scope.row.product.product_name }}</span>
  35. <span v-else>{{ scope.row.product?scope.row.product.product_name:'-' }}</span>
  36. <span class="dec">商品编码:{{ scope.row.product?scope.row.product.product_id:'-' }}</span>
  37. </template>
  38. </div>
  39. </div>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="下单用户" width="340" prop="name">
  43. <template #default="scope">
  44. <div class="goods-img">
  45. <div class="img">
  46. <el-image
  47. style="width: 54px; height: 54px"
  48. :src="scope.row.user.avatar"
  49. :zoom-rate="1.2"
  50. :max-scale="7"
  51. :min-scale="0.2"
  52. :preview-src-list="[scope.row.user.avatar]"
  53. preview-teleported
  54. z-index="999"
  55. fit="cover"></el-image>
  56. </div>
  57. <div class="name">
  58. <span>{{ scope.row.user.nickname }}</span>
  59. <span class="dec">{{ scope.row.user.openid }}</span>
  60. </div>
  61. </div>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="商品售价" prop="types" width="120" align="right">
  65. <template #default="scope">
  66. <div class="order-name">
  67. <span>{{ scope.row.price?$TOOL.money(scope.row.price):'-' }}</span>
  68. <span class="dec">{{ scope.row.number }}份</span>
  69. </div>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="顾客支付" prop="types" width="120" align="right">
  73. <template #default="scope">
  74. {{ scope.row.pay_money?$TOOL.money(scope.row.pay_money):'-' }}
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="留资号码" prop="types" width="120">
  78. <template #default="scope">
  79. {{ scope.row.mobile?scope.row.mobile:'-' }}
  80. </template>
  81. </el-table-column>
  82. <el-table-column label="订单状态" prop="types" width="160" align="left">
  83. <template #default="scope">
  84. <div class="order-name" v-if="scope.row.status == 0">
  85. <span>待支付</span>
  86. <span class="dec" v-if="scope.row.end_time.min == 0 && scope.row.end_time.sec == 0">已超时,取消支付</span>
  87. <span class="dec" v-else>剩余{{ scope.row.end_time.min }}:{{ scope.row.end_time.sec }}</span>
  88. </div>
  89. <div class="order-name" v-if="scope.row.status == 1">
  90. <span>待使用</span>
  91. </div>
  92. <div class="order-name" v-if="scope.row.status == 2">
  93. <span v-if="scope.row.is_error == 1" style="color: #f00;">异常</span>
  94. <span v-else>已完成</span>
  95. </div>
  96. <div class="order-name" v-if="scope.row.status == 3">
  97. <span>已退款</span>
  98. <span class="dec">款项已原路退回</span>
  99. </div>
  100. <div class="order-name" v-if="scope.row.status == 4">
  101. <span>退款中</span>
  102. <span class="dec">款项已原路退回</span>
  103. </div>
  104. <div class="order-name" v-if="scope.row.status == 5">
  105. <span>已关闭</span>
  106. <span class="dec">用户已取消</span>
  107. </div>
  108. <div class="order-name" v-if="scope.row.status == 6">
  109. <span>部分退款</span>
  110. <span class="dec">已退款 <em style="color: #f00;">{{ scope.row.refund_num }}</em> 份</span>
  111. </div>
  112. <div class="order-name" v-if="scope.row.status == 7">
  113. <span>履约中</span>
  114. <span class="dec">货物运输中</span>
  115. </div>
  116. <div class="order-name" v-if="scope.row.status == 8">
  117. <span>退款审核中</span>
  118. <span class="dec">已发快递,等待审核拦截</span>
  119. </div>
  120. </template>
  121. </el-table-column>
  122. <el-table-column label="发货状态" prop="types" width="160" align="left">
  123. <template #default="scope">
  124. <div v-if="scope.row.status == 2">
  125. <div class="order-name" v-if="scope.row.express_status == 1 || scope.row.express_status == 0">
  126. <span>待发货</span>
  127. </div>
  128. <div class="order-name" v-if="scope.row.express_status == 2">
  129. <span>已发货</span>
  130. </div>
  131. <div class="order-name" v-if="scope.row.express_status == 3">
  132. <span>已签收</span>
  133. </div>
  134. </div>
  135. <div v-else>待订单完成</div>
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="来源达人" prop="scene" width="260">
  139. <template #default="scope">
  140. <div class="goods-img" v-if="scope.row.star">
  141. <div class="name">
  142. <span>{{ scope.row.star?scope.row.star.nick_name:'-' }}</span>
  143. <span class="dec">抖音ID:{{ scope.row.star?scope.row.star.uid:'-' }}</span>
  144. </div>
  145. </div>
  146. <div v-else>-</div>
  147. </template>
  148. </el-table-column>
  149. <el-table-column label="来源" prop="scene" width="160"></el-table-column>
  150. <el-table-column label="下单时间" prop="create_at" width="160"></el-table-column>
  151. <el-table-column label="支付时间" prop="pay_at" width="160">
  152. <template #default="scope">
  153. {{ scope.row.pay_at?scope.row.pay_at:'未支付' }}
  154. </template>
  155. </el-table-column>
  156. <el-table-column label="核销时间" prop="pay_at" width="160">
  157. <template #default="scope">
  158. {{ scope.row.done_at?scope.row.done_at:'-' }}
  159. </template>
  160. </el-table-column>
  161. <el-table-column label="操作" width="140" align="left" fixed="right">
  162. <template #default="scope">
  163. <el-button-group>
  164. <el-button size="small" text @click="table_view(scope.row)">详情</el-button>
  165. <el-button type="danger" size="small" text @click="table_refund(scope.row)" v-if="scope.row.status==1">退款</el-button>
  166. <el-button type="danger" size="small" text @click="table_done(scope.row)" v-if="scope.row.status==7 && scope.row.is_new==1">核销</el-button>
  167. </el-button-group>
  168. <el-button-group>
  169. <el-button type="danger" size="small" text @click="table_black(scope.row)">拉黑</el-button>
  170. </el-button-group>
  171. </template>
  172. </el-table-column>
  173. </scTable>
  174. <orderDetail ref="orderDetail" @success="orderSuccess"></orderDetail>
  175. </template>
  176. <script>
  177. import orderDetail from "@/components/imFloat/order";
  178. export default {
  179. components:{
  180. orderDetail
  181. },
  182. props: {
  183. trade: { type: String, default: "0" },
  184. },
  185. data(){
  186. return {
  187. list: {
  188. apiObj: this.$API.merOrder.list
  189. },
  190. dataSelect:[],
  191. dataSelectFull:[],
  192. searchKey:{}
  193. }
  194. },
  195. methods: {
  196. tableRowClassName(row, rowIndex) {
  197. if (row.row.is_error === 1) {
  198. return 'error-row';
  199. } else {
  200. return 'success-row';
  201. }
  202. },
  203. orderSuccess(){
  204. this.$refs.table.refresh()
  205. },
  206. table_view(data){
  207. this.$nextTick(() => {
  208. data.order = data.out_order_no
  209. this.$refs.orderDetail.open("edit").setData(data)
  210. })
  211. },
  212. table_black(data){
  213. this.$confirm(`拉黑该用户后,用户再整个系统将无法再次下单`, '提示', {
  214. type: 'warning'
  215. }).then(async () => {
  216. var loading = this.$loading();
  217. var resp = await this.$API.merOrder.black.post({"order":data.out_order_no,});
  218. loading.close();
  219. if (resp.code == 0) {
  220. return this.$message.error(resp.msg);
  221. }
  222. this.$message.success(resp.msg);
  223. this.$refs.table.refresh()
  224. }).catch(() => {
  225. })
  226. },
  227. table_refund(data){
  228. this.$confirm(`该操作退款为直接为订单申请退款,无需用户二次操作`, '提示', {
  229. type: 'warning'
  230. }).then(async () => {
  231. var loading = this.$loading();
  232. var resp = await this.$API.merOrder.refundUser.post({"order":data.out_order_no,});
  233. loading.close();
  234. if (resp.code == 0) {
  235. return this.$message.error(resp.msg);
  236. }
  237. this.$message.success(resp.msg);
  238. this.$refs.table.refresh()
  239. }).catch(() => {
  240. })
  241. },
  242. table_del(data){
  243. },
  244. table_done(data){
  245. this.$confirm(`核销后,订单不再支持退款,确定要执行吗`, '提示', {
  246. type: 'warning'
  247. }).then(async () => {
  248. var resp = await this.$API.merOrder.doneMini.post({"order":data.out_order_no});
  249. if (resp.code == 0) {
  250. return this.$message.error(resp.msg);
  251. }
  252. this.$message.success(resp.msg);
  253. this.$refs.table.refresh()
  254. }).catch(() => {
  255. })
  256. },
  257. table_cancel(data){
  258. this.$confirm(`取消该笔订单的核销,并非是直接退款,订单状态将恢复到【待使用】状态`, '提示', {
  259. type: 'warning'
  260. }).then(async () => {
  261. var resp = await this.$API.merOrder.save.post({"order":data.out_order_no,"field":'status',"val":1});
  262. if (resp.code == 0) {
  263. return this.$message.error(resp.msg);
  264. }
  265. this.$message.success(resp.msg);
  266. this.$refs.table.refresh()
  267. }).catch(() => {
  268. })
  269. },
  270. table_error(data){
  271. this.$confirm(`订单标记异常后,该笔订单只能通过【异常订单】中进行下一步的操作,并且需等待24小时后系统判定后方可操作`, '提示', {
  272. type: 'warning'
  273. }).then(async () => {
  274. var resp = await this.$API.merOrder.save.post({"order":data.out_order_no,"field":'is_error',"val":1});
  275. if (resp.code == 0) {
  276. return this.$message.error(resp.msg);
  277. }
  278. this.$message.success(resp.msg);
  279. this.$refs.table.refresh()
  280. }).catch(() => {
  281. })
  282. },
  283. refresh(){
  284. this.$refs.table.refresh()
  285. },
  286. upData(data){
  287. this.$refs.table.upData(data)
  288. },
  289. handleSuccess(){
  290. this.$refs.table.refresh()
  291. },
  292. sortChange(event){
  293. if (event.order) {
  294. var data = {
  295. "field":event.prop,
  296. "order":event.order
  297. }
  298. this.$refs.table.upData(data)
  299. } else {
  300. this.$refs.table.reload(this.searchKey)
  301. }
  302. return ;
  303. },
  304. selectionChange(event){
  305. this.dataSelect = [];
  306. var arr = [];
  307. var arrCompany = [];
  308. event.forEach(function(val,index){
  309. arr[index] = val.id;
  310. arrCompany[index] = val;
  311. });
  312. this.dataSelectFull = arrCompany;
  313. this.dataSelect = arr;
  314. this.$emit("success",this.dataSelect);
  315. this.$emit("successFull",this.dataSelectFull);
  316. },
  317. }
  318. }
  319. </script>
  320. <style>
  321. .order-name span{display: block;}
  322. .order-name span.dec{color: #999;font-size: 12px;}
  323. .goods-img{display: flex;gap: 5px;}
  324. .goods-img .name span{display: block;}
  325. .goods-img .name span.dec{color: #999;font-size: 12px;}
  326. .goods-price,.price{display: flex;align-items: center;gap: 5px;font-size: 14px;}
  327. .goods-price .del{text-decoration: line-through;}
  328. .goods-price span{background-color: #fff !important;
  329. border: 1px solid #d3d9e0 !important;
  330. border-radius: 4px;
  331. box-sizing: border-box;
  332. color: #6c737a !important;
  333. display: inline-flex;
  334. flex: none;
  335. font-size: 12px;
  336. line-height: 18px !important;
  337. padding: 1px 6px !important;text-decoration: none;}
  338. </style>