index.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <el-card shadow="never">
  3. <yun-table
  4. :columns="columns"
  5. search="name,phone"
  6. toolbar="refresh,settlement"
  7. ref="yuntable"
  8. :auth="auth"
  9. :extend="extend"
  10. :show-summary="true"
  11. :total-arr="totalArr"
  12. :is-showtotal="true"
  13. @data-loaded="handleData"
  14. >
  15. <template #toolbar="{tool}">
  16. <template v-if="tool=='settlement'">
  17. <el-button type="primary" @click="createAddon">
  18. 结算
  19. </el-button>
  20. </template>
  21. </template>
  22. </yun-table>
  23. </el-card>
  24. </template>
  25. <script>
  26. import table from "@components/Table.js";
  27. export default{
  28. components:{'YunTable':table},
  29. data:{
  30. checkedKey:[],
  31. auth:{
  32. recyclebin:Yunqi.auth.check('app\\admin\\controller\\shop\\ShopList','recyclebin'),
  33. },
  34. extend:{
  35. index_url: 'shop/shop_delivery/index',
  36. recyclebin_url: 'shop/shop_delivery/recyclebin',
  37. },
  38. columns:[
  39. {checkbox: true,selectable:function (row,index){
  40. if(row.status != 1){
  41. return false;
  42. }
  43. return true;
  44. }},
  45. {field: 'customer.name',title: __('客户'),operate:'LIKE'},
  46. {field: 'plat_id',title: __('平台'), operate: 'select', searchList: Yunqi.data.platformList},
  47. {field: 'shops.name',title: __('店铺'),operate:'LIKE'},
  48. {field: 'variety_name', title: __('品种'),operate: 'LIKE'},
  49. {field: 'spec_name', title: __('规格'),operate: 'LIKE'},
  50. {field: 'box_name', title: __('包装箱'),operate: 'LIKE'},
  51. {field: 'num', title: __('数量'),operate: '='},
  52. {field: 'weigh', title: __('重量'),operate: false},
  53. {field: 'price', title: __('发货价'),operate: false},
  54. {field: 'total_price', title: __('总价'),operate: false},
  55. {field: 'company_name', title: __('快递名称'),operate: 'LIKE'},
  56. {field: 'waybill_no', title: __('快递单号'),operate: 'LIKE'},
  57. {field: 'region', title: __('省市'),operate: false},
  58. {field: 'labor_cost_money', title: __('工价'),operate: false},
  59. {field: 'other_price', title: __('偏远加收金额'),operate: false},
  60. { field: "incubator", title: "保温箱", operate: "select", searchList: { 0: "不是保温箱",1: "单层保温", 2: "双层保温" },formatter: function (data, row) {
  61. let tag = Yunqi.formatter.tag;
  62. if (row.incubator == 1) {
  63. tag.value = '单层保温';
  64. tag.type = 'warning';
  65. } else if (row.incubator == 2) {
  66. tag.value = '双层保温';
  67. tag.type = 'danger';
  68. } else {
  69. tag.value = '不是保温箱';
  70. tag.type = 'info';
  71. }
  72. return tag;
  73. } },
  74. {field: 'insulation_money', title: __('保温加收金额'),operate: false},
  75. {field: 'ship_date', title: __('发货时间'),operate: 'LIKE'},
  76. {field: 'nickname', title: __('录入人'),operate: 'LIKE'},
  77. {field: 'entry_time', title: __('录入时间'),operate: 'LIKE',formatter: Yunqi.formatter.datetime},
  78. {field: 'settlement_data', title: __('结算时间'),width: 100,operate:'date'},
  79. {field: 'status', title: __('结算状态'), operate: 'select', width:85,searchList: {1: __('待结算'),2: __('已结算')},formatter:Yunqi.formatter.tag},
  80. {field: 'createtime', title: __('创建时间'), width:120,formatter: Yunqi.formatter.datetime,operate:false,sortable: true},
  81. ],
  82. totalArr: [
  83. ],
  84. },
  85. methods: {
  86. handleData(data) {
  87. this.totalArr = [
  88. {
  89. name:"发货数量汇总",
  90. value: data.total_num
  91. },{
  92. name:"发货重量汇总",
  93. value: data.total_weigh
  94. },{
  95. name:"发货总价汇总",
  96. value: data.total_price
  97. },
  98. ]
  99. },
  100. createAddon() {
  101. let ids=[];
  102. let checks = this.$refs.yuntable.selections;
  103. for (var key in Object(checks)) {
  104. ids.push(checks[key]['id'])
  105. }
  106. if(ids.length == 0){
  107. this.$message({type: 'error', message: '请选择要结算的记录'});
  108. return
  109. }
  110. this.$confirm('一旦结算将不可撤回', '提示', {
  111. confirmButtonText: '确定',
  112. cancelButtonText: '取消',
  113. type: 'warning'
  114. }).then((res) => {
  115. Yunqi.ajax.post('shop/shop_delivery/settlement', {ids: ids }, false, false, true).then(res => {
  116. if (res.code == 200) {
  117. this.$message.success(__('结算成功'));
  118. this.$refs.yuntable.reload();
  119. } else {
  120. this.$message.error(res.msg);
  121. return false;
  122. }
  123. });
  124. }).catch(() => {
  125. this.$message({ type: 'info', message: '已取消结算'});
  126. });
  127. }
  128. },
  129. }
  130. </script>
  131. <style>
  132. </style>