hwb0 пре 3 година
родитељ
комит
ed02d86e8c

+ 45 - 1
src/api/business/order.js

@@ -19,6 +19,24 @@ export function companyList(data) {
   })
 }
 
+// 经销商盲票组列表
+export function channelList(data) {
+  return request({
+    url: '/api/v1/mp/admin/channel/order/item/list',
+    method: 'post',
+    data
+  })
+}
+
+// 经销商订单发货查询筛选待售的盲票包列表
+export function ticketPkgList(data) {
+  return request({
+    url: '/api/v1/mp/admin/channel/order/ticket/pkg/list',
+    method: 'post',
+    data
+  })
+}
+
 // 经销商订单详情
 export function orderDetail(data) {
   return request({
@@ -28,8 +46,16 @@ export function orderDetail(data) {
   })
 }
 
+// 经销商订单发货
+export function channelOrderShip(data) {
+  return request({
+    url: '/api/v1/mp/admin/channel/order/ship',
+    method: 'post',
+    data
+  })
+}
+
 // 用户订单
-// 
 export function getDeliverList(urlParams, data) {
   return request({
       url: '/api/v1/mp/admin/deliver/order/list',
@@ -46,4 +72,22 @@ export function deliverDetail(data) {
     method: 'post',
     data
   })
+}
+
+// 用户订单发货
+export function deliverOrderShip(data) {
+  return request({
+    url: '/api/v1/mp/admin/deliver/order/ship',
+    method: 'post',
+    data
+  })
+}
+
+// 用户订单导出
+export function deliverOrderExport(data) {
+  return request({
+    url: '/api/v1/mp/admin/deliver/order/export',
+    method: 'post',
+    data
+  })
 }

+ 59 - 18
src/views/order/channel/detail.vue

@@ -1,5 +1,6 @@
 <template>
   <div class="app-container">
+    <!-- 订单信息 -->
     <div class="info">
       <div class="info-title">订单信息</div>
       <div class="info-item">
@@ -16,49 +17,55 @@
         <div class="info-item-content">
           <div class="info-item-content-one">
             <div class="title">下单时间:</div>
-            <div class="txt">{{ parseTime(info.createdTime)}}</div>
+            <div class="txt">{{ parseTime(info.createdTime) }}</div>
           </div>
         </div>
       </div>
     </div>
+    <!-- 卖家信息 -->
     <div class="info">
       <div class="info-title">买家信息</div>
       <div class="info-item">
         <div class="info-item-content">
           <div class="info-item-content-one">
             <div class="title">经销商:</div>
-            <div class="txt">{{ info.receiver }}</div>
+            <div class="txt">{{ info.channel && info.channel.contact }}</div>
           </div>
           <div class="info-item-content-one">
             <div class="title">收货人:</div>
-            <div class="txt">{{ info.receiver }}</div>
+            <div class="txt">{{ info.receiver || "--" }}</div>
           </div>
           <div class="info-item-content-one">
             <div class="title">联系电话:</div>
-            <div class="txt">{{ info.tel }}</div>
+            <div class="txt">{{ info.tel || "--" }}</div>
           </div>
         </div>
         <div class="info-item-content">
           <div class="info-item-content-one">
             <div class="title">收货地址:</div>
             <div class="">
-              {{ `${info.province}${info.city}${info.area}${info.address}` }}
+              {{
+                `${info.province || "--"}${info.city || "--"}${
+                  info.area || "--"
+                }${info.address || "--"}`
+              }}
             </div>
           </div>
         </div>
       </div>
     </div>
+    <!-- 订单状态 -->
     <div class="info">
       <div class="info-title">订单状态</div>
       <div class="info-item">
         <div class="info-item-content">
           <div class="info-item-content-one">
             <div class="title">订单状态:</div>
-            <div class="txt">{{ status.desc }}</div>
+            <div class="txt">{{ status.desc || "--" }}</div>
           </div>
           <div class="info-item-content-one" v-if="status.value === 2">
             <div class="title">发货时间:</div>
-            <div class="txt">{{ '--' }}</div>
+            <div class="txt">{{ parseTime(info.deliveryTime) || "--" }}</div>
           </div>
         </div>
         <div class="info-item-content">
@@ -71,16 +78,16 @@
           >
           <div class="info-item-content-one" v-if="status.value === 2">
             <div class="title">快递公司:</div>
-            <div class="txt">{{ '--' }}</div>
+            <div class="txt">{{ delivery.companyName || "--" }}</div>
           </div>
           <div class="info-item-content-one" v-if="status.value === 2">
             <div class="title">快递单号:</div>
-            <div class="txt">{{ '--' }}</div>
+            <div class="txt">{{ info.deliveryFlowId || "--" }}</div>
           </div>
         </div>
       </div>
     </div>
-
+    <!-- 商品信息 -->
     <div class="info">
       <div class="info-title">商品信息</div>
       <div class="info-table">
@@ -121,34 +128,64 @@
         </div>
       </div>
     </div>
+
+    <!-- 发货 -->
+    <send-goods
+      :send-show="goodsShow"
+      :goods-info="info"
+      :channel-list="boxData"
+      @close="close"
+    />
   </div>
 </template>
 <script>
-import { orderDetail } from "@/api/business/order";
+import { orderDetail, channelList } from "@/api/business/order";
 import { publicFileGetUrl } from "@/api/common";
 import { accMul } from "@/utils/util";
+import SendGoods from "./components/SendGoods";
 export default {
   name: "Detail",
+  components: {
+    SendGoods,
+  },
   data() {
     return {
+      // 订单ID
       orderId: "",
+      // 订单详情
       info: {},
+      // 订单状态
       status: {},
+      // 物流信息
+      delivery: {},
+      // 商品列表
       list: [],
+      // 发货弹框显示
+      goodsShow: false,
+      // 盲票组列表
+      boxData: [],
     };
   },
   created() {
     this.orderId = this.$route.query.id;
-    console.log(this.orderId);
     this.getDetail();
+    this.getChannelList();
   },
   methods: {
+    // 盲票组列表
+    getChannelList(row) {
+      channelList({ orderId: this.orderId }).then((res) => {
+        this.boxData = res.data;
+      });
+    },
+
+    // 订单详情
     getDetail() {
       orderDetail({ orderId: this.orderId }).then((res) => {
-        console.log("res", res);
         if (res.code == 0) {
           this.info = res.data;
           this.status = JSON.parse(res.data.status);
+          this.delivery = res.data.deliveryCompany;
           res.data.items.forEach((item) => {
             let picUrlArr = item.picUrl.split(",");
             item.picUrl = publicFileGetUrl + picUrlArr[0];
@@ -158,13 +195,17 @@ export default {
       });
     },
 
-    toGoods(){
+    // 点击发货
+    toGoods() {
+      this.goodsShow = true;
+    },
 
-    }
+    // 发货弹框关闭
+    close() {
+      this.goodsShow = false;
+      this.getDetail();
+    },
   },
-  components: {},
-  mounted() {},
-  destroyed() {},
 };
 </script>
 <style lang="scss" scoped>

+ 55 - 84
src/views/order/channel/index.vue

@@ -32,6 +32,7 @@
           v-model="queryParams.channelId"
           placeholder="可输入经销商名称/手机号码搜索"
           clearable
+          filterable
           size="small"
           style="width: 240px"
           @change="handleQuery"
@@ -154,14 +155,14 @@
         <template slot-scope="{ row }">
           <div>
             <el-button
-              v-hasPermi="['business:ticket:on']"
+              v-hasPermi="['order:channel:query']"
               type="text"
               @click="getDetail(row)"
               >查看详情</el-button
             >
             <el-button
               v-if="row.status.value === 1"
-              v-hasPermi="['business:ticket:on']"
+              v-hasPermi="['order:channel:ship']"
               type="text"
               @click="toGoods(row)"
               >发货</el-button
@@ -171,6 +172,7 @@
       </el-table-column>
     </el-table>
 
+    <!-- 分页 -->
     <pagination
       v-show="total > 0"
       :total="total"
@@ -179,83 +181,29 @@
       @pagination="getList"
     />
 
-    <el-dialog
-      title="订单发货"
-      :visible.sync="goodsShow"
-      width="800px"
-      :before-close="close"
-    >
-      <el-form :model="shipForm" ref="queryForm" label-width="100px">
-        <el-form-item label="订单号:">
-          <span>{{ goodsInfo.orderId }}</span>
-        </el-form-item>
-        <el-form-item label="收货地址:">
-          <span>{{
-            `${goodsInfo.receiver},${goodsInfo.tel},${goodsInfo.province}${goodsInfo.city}${goodsInfo.area}${goodsInfo.address}`
-          }}</span>
-        </el-form-item>
-        <el-form-item label="快递公司:">
-          <el-select
-            v-model="shipForm.deliveryId"
-            placeholder="请选择快递公司"
-            clearable
-            size="small"
-            style="width: 300px"
-          >
-            <el-option
-              v-for="item in companyData"
-              :key="item.areaId"
-              :label="item.companyName"
-              :value="item.deliveryId"
-            />
-          </el-select>
-        </el-form-item>
-        <el-form-item label="快递单号:">
-          <el-input
-            v-model="shipForm.deliveryFlowId"
-            placeholder="输入快递单号"
-            clearable
-            size="small"
-            style="width: 300px"
-          />
-        </el-form-item>
-        <el-form-item label="盲票组:">
-          <el-select
-            v-model="shipForm.deliveryId"
-            placeholder="请选择盲票组"
-            clearable
-            size="small"
-            style="width: 300px"
-          >
-            <el-option
-              v-for="item in companyData"
-              :key="item.areaId"
-              :label="item.companyName"
-              :value="item.deliveryId"
-            />
-          </el-select>
-        </el-form-item>
-        <el-form-item label="盲票包序号:">
-          <el-input
-            v-model="shipForm.deliveryFlowId"
-            placeholder="输入盲票包序号"
-            clearable
-            size="small"
-            style="width: 300px"
-          />
-        </el-form-item>
-      </el-form>
-    </el-dialog>
+    <!-- 发货 -->
+    <send-goods
+      :send-show="goodsShow"
+      :goods-info="goodsInfo"
+      :channel-list="boxData"
+      @close="close"
+    />
   </div>
 </template>
 <script>
-import { getOrderList, companyList } from "@/api/business/order";
+import { getOrderList, companyList, channelList } from "@/api/business/order";
 import { publicFileGetUrl } from "@/api/common";
+import SendGoods from "./components/SendGoods";
 export default {
+  name: "Channel",
+  components: {
+    SendGoods,
+  },
   data() {
     return {
       loading: false,
       showSearch: true,
+      // 筛选
       queryParams: {
         title: "",
         orderId: "",
@@ -264,6 +212,7 @@ export default {
         channelId: "",
         status: null,
       },
+      // 分页
       pageParams: {
         pageNum: 1,
         pageSize: 10,
@@ -277,21 +226,19 @@ export default {
       tradeTimeArr: [],
       // 订单列表状态
       state: "null",
-
+      // 弹框显示
       goodsShow: false,
+      // 订单详情
       goodsInfo: {},
-      shipForm: {
-        deliveryId: "",
-        deliveryFlowId: "",
-      },
-      companyData: [],
+      // 盲票组下拉列表
+      boxData: [],
     };
   },
   created() {
     this.getList();
-    this.getCompanyList();
   },
   methods: {
+    // 订单列表
     getList() {
       this.loading = true;
       getOrderList(
@@ -321,17 +268,33 @@ export default {
           this.loading = false;
         });
     },
-    getCompanyList() {
-      companyList({}).then((res) => {
-        this.companyData = res.data;
+
+    // 盲票组列表
+    getChannelList(row) {
+      channelList({ orderId: row.orderId }).then((res) => {
+        this.boxData = res.data;
       });
     },
+
     //搜索
     handleQuery() {
-      this.getList()
+      this.getList();
     },
+
     // 重置
-    resetQuery() {},
+    resetQuery() {
+      this.queryParams = {
+        title: "",
+        orderId: "",
+        startTime: "",
+        endTime: "",
+        channelId: "",
+        status: null,
+      };
+      this.tradeTimeArr = [];
+      this.getList();
+    },
+
     // 选择下单时间
     tardeTime(e) {
       if (e) {
@@ -344,21 +307,29 @@ export default {
         this.handleQuery();
       }
     },
+
     // 订单切换
     handleClick(e) {
-      this.queryParams.status = Number(e.name)
-      this.getList()
+      this.queryParams.status = Number(e.name);
+      this.getList();
     },
+
     // 查看详情
     getDetail(row) {
       this.$router.push({ name: "Detail", query: { id: row.orderId } });
     },
+
+    // 点击发货
     toGoods(row) {
       this.goodsShow = true;
       this.goodsInfo = row;
+      this.getChannelList(row);
     },
+
+    // 关闭发货弹框
     close() {
       this.goodsShow = false;
+      this.getList();
     },
   },
 };

+ 131 - 40
src/views/order/deliver/components/SendGoods.vue

@@ -3,10 +3,15 @@
     <el-dialog
       title="订单发货"
       :visible.sync="sendShow"
-      width="800px"
+      width="1000px"
       :before-close="close"
     >
-      <el-form :model="shipForm" ref="queryForm" label-width="100px">
+      <el-form
+        :model="shipForm"
+        ref="shipForm"
+        :rules="rules"
+        label-width="100px"
+      >
         <el-form-item label="订单号:">
           <span>{{ goodsInfo.orderId }}</span>
         </el-form-item>
@@ -15,7 +20,7 @@
             `${goodsInfo.receiver},${goodsInfo.tel},${goodsInfo.province}${goodsInfo.city}${goodsInfo.area}${goodsInfo.address}`
           }}</span>
         </el-form-item>
-        <el-form-item label="快递公司:">
+        <el-form-item label="快递公司:" prop="deliveryId">
           <el-select
             v-model="shipForm.deliveryId"
             placeholder="请选择快递公司"
@@ -31,82 +36,168 @@
             />
           </el-select>
         </el-form-item>
-        <el-form-item label="快递单号:">
+        <el-form-item label="快递单号:" prop="deliveryFlowId">
           <el-input
-            v-model="shipForm.deliveryFlowId"
+            v-model.number="shipForm.deliveryFlowId"
             placeholder="输入快递单号"
             clearable
             size="small"
             style="width: 300px"
           />
         </el-form-item>
-        <el-form-item label="盲票组:">
-          <el-select
-            v-model="shipForm.deliveryId"
-            placeholder="请选择盲票组"
-            clearable
-            size="small"
-            style="width: 300px"
-          >
-            <el-option
-              v-for="item in companyData"
-              :key="item.areaId"
-              :label="item.companyName"
-              :value="item.deliveryId"
-            />
-          </el-select>
-        </el-form-item>
-        <el-form-item label="盲票包序号:">
-          <el-input
-            v-model="shipForm.deliveryFlowId"
-            placeholder="输入盲票包序号"
-            clearable
-            size="small"
-            style="width: 300px"
-          />
-        </el-form-item>
       </el-form>
+      <!-- 商品 -->
+      <el-table
+        ref="table"
+        :data="goodsInfo.items"
+        @selection-change="handleSelectionGoods"
+        class="ticket-table"
+      >
+        <el-table-column
+          type="selection"
+          width="55"
+          align="center"
+          fixed="left"
+        />
+        <el-table-column label="商品名称" prop="title" />
+        <el-table-column label="规格">
+          <template slot-scope="{ row }">
+            <div>{{ row.properties || "--" }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column label="数量">
+          <template slot-scope="{ row }">
+            <div>{{ row.goodsNum }}件</div>
+          </template>
+        </el-table-column>
+        <el-table-column label="快递公司">
+          <template slot-scope="{ row }">
+            <div>{{ row.deliveryId || "--" }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column label="快递单号">
+          <template slot-scope="{ row }">
+            <div>{{ row.deliveryFlowId || "--" }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column label="发货状态">
+          <template slot-scope="{ row }">
+            <div>{{ row.deliveryFlowId ? "已发货" : "未发货" }}</div>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="close">取 消</el-button>
+        <el-button type="primary" :disabled="loading" @click="saveClick"
+          >确 定</el-button
+        >
+      </div>
     </el-dialog>
   </div>
 </template>
 <script>
-import { companyList } from "@/api/business/order";
+import CustomFieldsMixin from "@/mixins/CustomFields";
+import { companyList, deliverOrderShip } from "@/api/business/order";
 export default {
-  props:{
+  mixins: [CustomFieldsMixin],
+  props: {
+    // 弹框显示
     sendShow: {
       type: Boolean,
-      default: false
+      default: false,
     },
+    // 订单详情
     goodsInfo: {
       type: Object,
-      default: {}
-    }
+      default: {},
+    },
   },
   created() {
     this.getCompanyList();
   },
   data() {
     return {
+      loading: false,
       shipForm: {
         deliveryId: "",
         deliveryFlowId: "",
       },
+      // 快递下拉列表
       companyData: [],
+      // 选中商品ID
+      ids: [],
+      rules: {
+        deliveryId: [
+          { required: true, message: "请选择快递公司", trigger: "change" },
+        ],
+        deliveryFlowId: [
+          { required: true, message: "请输入快递单号", trigger: "blur" },
+          { type: "number", message: "快递单号为数字值", trigger: "blur" },
+        ],
+      },
     };
   },
   methods: {
-    close(){
-      this.$emit('close')
+    // 关闭发货弹框
+    close() {
+      this.$emit("close");
+      this.loading = false;
+      this.ids = [];
+      this.$refs["shipForm"].resetFields();
     },
+
+    // 快递下拉列表
     getCompanyList() {
       companyList({}).then((res) => {
         this.companyData = res.data;
       });
     },
+
+    // 选中商品
+    handleSelectionGoods(e) {
+      this.ids = e.map((item) => item.itemId);
+    },
+
+    // 确认
+    saveClick() {
+      this.loading = true;
+      const subForm = this.$refs["shipForm"];
+      subForm.validate((valid) => {
+        if (valid) {
+          this.submitForm(this.shipForm);
+        } else {
+          this.loading = false;
+          // 提示第一个error
+          this.getFormErrorMessage(subForm);
+          return false;
+        }
+      });
+    },
+
+    // 提交
+    submitForm(form) {
+      if (!this.ids.length) {
+        this.msgError("请选择发货的商品");
+        this.loading = false;
+        return;
+      }
+      let data = {
+        ...form,
+        orderId: this.goodsInfo.orderId,
+        itemIds: this.ids,
+      };
+      deliverOrderShip(data)
+        .then((res) => {
+          if (res.code == 0) {
+            this.msgSuccess("发货成功");
+            this.close();
+          }
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
   },
-  components: {},
-  mounted() {},
-  destroyed() {},
 };
 </script>
 <style>