浏览代码

商品提货订单,增加超时未发货的短信发送功能

DELL 3 年之前
父节点
当前提交
214d12e93c
共有 2 个文件被更改,包括 86 次插入6 次删除
  1. 10 0
      src/api/business/order.js
  2. 76 6
      src/views/order/deliver/index.vue

+ 10 - 0
src/api/business/order.js

@@ -18,6 +18,16 @@ export function listSite( data) {
   })
 }
 
+//批量发送短信
+export function batchshortMessage( data) {
+  return request({
+    url: '/api/v1/mp/admin/deliver/order/sendSMS',
+    method: 'post',
+    data,
+  })
+}
+
+
 // 快递下拉
 export function companyList(data) {
   return request({

+ 76 - 6
src/views/order/deliver/index.vue

@@ -120,6 +120,18 @@
         >批量发货
         </el-button>
       </el-col>
+<!--      =====================================================================================================================================================================================-->
+      <el-col :span="1.5">
+        <el-button
+          type="infor"
+          plain
+          icon="el-icon-position"
+          size="small"
+          @click="batchshortMessageFun"
+          v-hasPermi="['order:deliver:ship']"
+        >发送发货超时短信
+        </el-button>
+      </el-col>
       <right-toolbar
         :showSearch.sync="showSearch"
         @queryTable="getList"
@@ -139,8 +151,12 @@
     <el-table ref="table" v-loading="loading" :data="list">
       <!-- 展开盲票组列表 -->
       <el-table-column type="expand">
-        <template slot-scope="{ row }">
-          <el-table :data="row.items">
+        <template slot-scope="{ row,$index }">
+          <el-table :data="row.items" row-key="itemId" @selection-change="handleSelectionChange( $event,row.orderId,row.tel )">
+            <el-table-column
+              type="selection"
+              width="55">
+            </el-table-column>
             <el-table-column label="商品图片" min-width="80">
               <div slot-scope="{ row }">
                 <el-image
@@ -286,7 +302,7 @@
 <script>
 import {
   getDeliverList,
-  deliverOrderExport, setBatchShip
+  deliverOrderExport, setBatchShip, batchshortMessage
 } from "@/api/business/order";
 import {publicFileGetUrl} from "@/api/common";
 import {getToken, getSign} from "@/utils/auth";
@@ -344,6 +360,7 @@ export default {
       reqData: {},
       responseData:'',
       SupplierList: [],
+      changeDate:[],//全部所选的商品
     };
   },
   created() {
@@ -351,6 +368,24 @@ export default {
     this.getSupplierItems()
   },
   methods: {
+    handleSelectionChange(goodsNameList,orderId,mobile) {
+      let arr = []
+      for (let i = 0; i < goodsNameList.length; i++) {
+        arr = [...arr,goodsNameList[i].title]
+      }
+      for(let i = 0;i < this.changeDate.length; i++ ){
+        if(this.changeDate[i].orderId == orderId){
+          this.changeDate[i].goodsNameList = arr
+          return
+        }
+      }
+      let data = {
+        goodsNameList: arr,
+        orderId,
+        mobile
+      }
+      this.changeDate.push(data)
+    },
     //获取供应商
     getSupplierItems(){
       getSupplierList('',{}).then(res => {
@@ -367,6 +402,7 @@ export default {
     },
       // 订单列表
     getList() {
+      this.changeDate = []
       let data = {
         ...this.queryParams,
         resource: Number(this.queryParams.resource)
@@ -417,7 +453,6 @@ export default {
         "x-zz-timestamp": timestamp
       }
       this.upload.headers = headers
-      console.log(this.upload)
     },
 
     // 自定义文件上传的实现
@@ -428,7 +463,6 @@ export default {
         ...data
       }
       setBatchShip(params, this.headers).then(response => {
-        //  console.log("importFileSaveAPI============ response.msg"+response.msg)
         this.upload.open = false;
         this.upload.isUploading = false;
         this.$refs.upload.clearFiles();
@@ -460,7 +494,6 @@ export default {
     },
     // 文件上传中处理
     handleFileUploadProgress(event, file, fileList) {
-      console.log(file)
       this.upload.isUploading = true;
     },
     // 文件上传成功处理
@@ -532,6 +565,43 @@ export default {
       this.goodsShow = false;
       this.getList();
     },
+    // 批量短信
+    batchshortMessageFun() {
+      for (let i = 0; i < this.changeDate.length; i++) {
+        if(this.changeDate[i].goodsNameList.length == 0) {
+          this.changeDate.splice(i,1)
+        }
+      }
+      if (this.changeDate.length == 0) {
+        this.$message.warning('请先选择商品');
+        return;
+      }
+      let num = 0
+      for (let i = 0; i < this.changeDate.length; i++) {
+        num = num + this.changeDate[i].goodsNameList.length
+      }
+      this.$confirm(`您确定要发送${num}条发货超时短信吗?`, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+      })
+        .then(() => {
+          this.vloading = this.$loading({
+            lock: true,
+            text: "正在发送短信.....",
+            background: "rgba(0, 0, 0, 0.7)",
+          });
+
+          return batchshortMessage(this.changeDate);
+        })
+        .then((response) => {
+          this.vloading.close();
+          this.getList();
+          this.$message.success('短信发送成功');
+        })
+        .catch(() => {
+          this.vloading.close();
+        });
+    },
 
     // 导出订单
     handleExportDraw() {