Browse Source

履约单管理发货和商品列表

jiandexin1 1 year ago
parent
commit
85e6ef5be5

+ 22 - 0
src/api/distribution/appoint.js

@@ -48,3 +48,25 @@ export const update = (row) => {
   })
 }
 
+export const shipments = (ids) => {
+  return request({
+    url: '/api/distribution/appoint/shipments',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}
+
+export const goodsList = (current, size, arrivalCode) => {
+  return request({
+    url: '/api/finance/appointgoods/appointGoodsList',
+    method: 'get',
+    params: {
+      arrivalCode,
+      current,
+      size,
+    }
+  })
+}
+

+ 39 - 0
src/option/mall/appointGoodsOption.js

@@ -0,0 +1,39 @@
+export const appointGoodsOption = {
+    height:'auto',
+    calcHeight: 30,
+    tip: false,
+    searchShow: true,
+    searchMenuSpan: 6,
+    border: true,
+    index: true,
+    viewBtn: true,
+    addBtn: false,
+    selection: true,
+    dialogClickModal: false,
+    menu: false,
+    column: [
+        {
+            label: "商品名称",
+            prop: "goodsName",
+            rules: [{
+                required: true,
+                message: "请输入商品名称",
+                trigger: "blur"
+            }]
+        },
+        {
+            label: "商品图片",
+            prop: "goodsImage",
+            type: 'img',
+        },
+        {
+            label: "商品数量",
+            prop: "goodsNum",
+            rules: [{
+                required: true,
+                message: "请输入商品数量",
+                trigger: "blur"
+            }]
+        },
+    ]
+}

+ 87 - 30
src/views/distribution/appoint.vue

@@ -19,21 +19,42 @@
                @refresh-change="refreshChange"
                @on-load="onLoad">
       <template slot="menuLeft">
-        <el-button type="danger"
+        <el-button type="primary"
                    size="small"
-                   icon="el-icon-delete"
                    plain
                    v-if="permission.appoint_delete"
-                   @click="handleDelete">删 除
+                   @click="handleDelete">确认发货
         </el-button>
       </template>
+      <template slot-scope="scope" slot="menu">
+        <el-button type="text"
+                   size="small"
+                   @click="goodsListView(scope.row.arrivalCode)">查看商品列表</el-button>
+      </template>
     </avue-crud>
+    <!--  商品列表dialog  -->
+    <el-dialog title="商品列表"
+               append-to-body
+               :visible.sync="goodsBox"
+               :before-close="handleClose"
+               width="50%"
+               heigh="30%">
+      <avue-crud :option="appointGoodsOption"
+                 :table-loading="goodsLoading"
+                 :data="appointGoodsData"
+                 :page.sync="goodsPage"
+                 ref="grouponCrud"
+                 @on-load="goodsOnLoad">
+      </avue-crud>
+    </el-dialog>
   </basic-container>
+
 </template>
 
 <script>
-  import {getList, getDetail, add, update, remove} from "@/api/distribution/appoint";
+  import {getList, getDetail, add, update, shipments, goodsList} from "@/api/distribution/appoint";
   import {mapGetters} from "vuex";
+  import {appointGoodsOption} from "../../option/mall/appointGoodsOption"
 
   export default {
     data() {
@@ -41,13 +62,26 @@
         form: {},
         query: {},
         loading: true,
+        goodsBox: false,
+        goodsLoading: false,
         page: {
           pageSize: 10,
           currentPage: 1,
           total: 0
         },
+        arrivalCode: '',
+        appointGoodsData: [],
+        goodsPage: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
         selectionList: [],
+        appointGoodsOption,
         option: {
+          selectable:(row,index)=>{
+            return row.state === 0;
+          },
           height:'auto',
           calcHeight: 30,
           tip: false,
@@ -56,20 +90,14 @@
           border: true,
           index: true,
           viewBtn: true,
+          delBtn: false,
           selection: true,
+          searchSpan: 5,
           dialogClickModal: false,
           column: [
-            {
-              label: "供应商ID",
-              prop: "storeId",
-              rules: [{
-                required: true,
-                message: "请输入供应商ID",
-                trigger: "blur"
-              }]
-            },
             {
               label: "供应商名称",
+              labelWidth: 130,
               prop: "storeName",
               rules: [{
                 required: true,
@@ -77,17 +105,9 @@
                 trigger: "blur"
               }]
             },
-            {
-              label: "自提点id",
-              prop: "takeId",
-              rules: [{
-                required: true,
-                message: "请输入自提点id",
-                trigger: "blur"
-              }]
-            },
             {
               label: "自提点名称",
+              labelWidth: 130,
               prop: "takeName",
               rules: [{
                 required: true,
@@ -96,25 +116,39 @@
               }]
             },
             {
-              label: "履约单状态:0、待发货,1、已发货,2已完成",
-              prop: "state",
+              label: "自提点联系电话",
+              labelWidth: 130,
+              prop: "takeTel",
               rules: [{
                 required: true,
-                message: "请输入履约单状态:0、待发货,1、已发货,2已完成",
+                message: "自提点联系电话",
                 trigger: "blur"
               }]
             },
             {
-              label: "团购id",
-              prop: "grouponId",
+              label: "履约单状态",
+              labelWidth: 130,
+              prop: "state",
+              searchLabelWidth: 130,
+              type: "select",
+              dicUrl: "/api/blade-system/dict-biz/dictionary?code=appoint_state",
+              props: {
+                label: "dictValue",
+                value: "dictKey"
+              },
+              dataType: "number",
+              search: true,
+              hide: false,
+              display: true,
               rules: [{
                 required: true,
-                message: "请输入团购id",
+                message: "选择状态",
                 trigger: "blur"
               }]
             },
             {
               label: "团购标题",
+              labelWidth: 130,
               prop: "grouponName",
               rules: [{
                 required: true,
@@ -124,6 +158,7 @@
             },
             {
               label: "团购结束时间",
+              labelWidth: 130,
               prop: "grouponEndTime",
               rules: [{
                 required: true,
@@ -168,6 +203,7 @@
           window.console.log(error);
         });
       },
+
       rowUpdate(row, index, done, loading) {
         update(row).then(() => {
           this.onLoad(this.page);
@@ -181,6 +217,7 @@
           console.log(error);
         });
       },
+
       rowDel(row) {
         this.$confirm("确定将选择数据删除?", {
           confirmButtonText: "确定",
@@ -203,13 +240,13 @@
           this.$message.warning("请选择至少一条数据");
           return;
         }
-        this.$confirm("确定将选择数据删除?", {
+        this.$confirm("确定将选择的履约单进行发货么?", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"
         })
           .then(() => {
-            return remove(this.ids);
+            return shipments(this.ids);
           })
           .then(() => {
             this.onLoad(this.page);
@@ -263,6 +300,26 @@
           this.loading = false;
           this.selectionClear();
         });
+      },
+
+      goodsListView(arrivalCode) {
+        this.arrivalCode = arrivalCode;
+        this.goodsOnLoad(this.goodsPage)
+        this.goodsBox = true;
+      },
+      handleClose() {
+        this.goodsBox = false;
+      },
+      goodsOnLoad(page){
+        console.log(this.arrivalCode, '------arrivalCode---------');
+        this.goodsLoading = true;
+        goodsList(page.currentPage, page.pageSize, this.arrivalCode).then(res => {
+          const data = res.data.data;
+          this.page.total = data.total;
+          this.appointGoodsData = data.records;
+          this.goodsLoading = false;
+          this.selectionClear();
+        });
       }
     }
   };