index.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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: __('录入时间'), width:80, operate:"date" },
  76. {field: 'settlement_data', title: __('结算时间'),width: 100,operate:'date'},
  77. {field: 'status', title: __('结算状态'), operate: 'select', width:85,searchList: {1: __('待结算'),2: __('已结算')},formatter:Yunqi.formatter.tag},
  78. {field: 'createtime', title: __('创建时间'), width:120,formatter: Yunqi.formatter.datetime,operate:false,sortable: true},
  79. {field: 'user.nickname', title: __('录入人'),operate: false},
  80. ],
  81. totalArr: [
  82. ],
  83. },
  84. methods: {
  85. handleData(data) {
  86. this.totalArr = [
  87. {
  88. name:"发货数量汇总",
  89. value: data.total_num
  90. },{
  91. name:"发货重量汇总",
  92. value: data.total_weigh
  93. },{
  94. name:"发货总价汇总",
  95. value: data.total_price
  96. },
  97. ]
  98. },
  99. createAddon() {
  100. let ids=[];
  101. let checks = this.$refs.yuntable.selections;
  102. for (var key in Object(checks)) {
  103. ids.push(checks[key]['id'])
  104. }
  105. if(ids.length == 0){
  106. this.$message({type: 'error', message: '请选择要结算的记录'});
  107. return
  108. }
  109. this.$confirm('一旦结算将不可撤回', '提示', {
  110. confirmButtonText: '确定',
  111. cancelButtonText: '取消',
  112. type: 'warning'
  113. }).then((res) => {
  114. Yunqi.ajax.post('shop/shop_delivery/settlement', {ids: ids }, false, false, true).then(res => {
  115. if (res.code == 200) {
  116. this.$message.success(__('结算成功'));
  117. this.$refs.yuntable.reload();
  118. } else {
  119. this.$message.error(res.msg);
  120. return false;
  121. }
  122. });
  123. }).catch(() => {
  124. this.$message({ type: 'info', message: '已取消结算'});
  125. });
  126. }
  127. },
  128. }
  129. </script>
  130. <style>
  131. </style>