阿拉蕾 1 year ago
parent
commit
3e9cfb3057

+ 8 - 0
src/api/company/companySms.js

@@ -32,6 +32,14 @@ export function sendCustomerMsg(data) {
     data: data
   })
 }
+
+export function sendStoreOrderMsg(data) {
+  return request({
+    url: '/company/companySms/sendStoreOrderMsg',
+    method: 'post',
+    data: data
+  })
+}
                                 
 export function sendCustomerBatchMsg(data) {
   return request({

+ 37 - 15
src/views/crm/components/addSms.vue

@@ -77,7 +77,7 @@
   
 <script>
     import { getSmsTempList } from "@/api/company/companySmsTemp";
-    import { sendCustomerMsg,getCompanySmsCount } from "@/api/company/companySms";
+    import { sendCustomerMsg,getCompanySmsCount,sendStoreOrderMsg } from "@/api/company/companySms";
     import cardSelect from '../../company/components/cardSelect.vue';
     export default {
         name: "visit",
@@ -85,6 +85,7 @@
         data() {
             return {
                 smsTemps:[],
+                type:null,
                 smsCount:0,
                 form: {
                     tempId:null,
@@ -136,11 +137,17 @@
                     this.showPickCard=false;
                 }
             },
-            reset(customerId,mobile) {
+            reset(customerId,mobile,type) {
                 this.form.customerId=customerId;
                 this.form.mobile=mobile;
+                this.type = type
+                this.getCompanySmsCount()       
+            },
+            getOrderId(orderId,mobile,type) {
+                this.form.orderId=orderId;
+                this.form.mobile=mobile;
+                this.type = type
                 this.getCompanySmsCount()
-                
             },
             submitForm() {
                 this.$refs["form"].validate(valid => {
@@ -161,18 +168,33 @@
                             spinner: 'el-icon-loading',
                             background: 'rgba(0, 0, 0, 0.7)'
                         });
-                        sendCustomerMsg(this.form).then(response => {
-                            this.myloading.close()
-                            if (response.code === 200) {
-                                this.msgSuccess(response.msg);
-                                
-                                this.$emit('close');
-                                
-                            }
-                            else{
-                                this.msgError(response.msg);
-                            }
-                        });
+                        if(this.type==1){
+                            sendCustomerMsg(this.form).then(response => {
+                                this.myloading.close()
+                                if (response.code === 200) {
+                                    this.msgSuccess(response.msg);
+                                    
+                                    this.$emit('close');
+                                }
+                                else{
+                                    this.msgError(response.msg);
+                                }
+                            });
+                        }
+                        if(this.type == 2){
+                            sendStoreOrderMsg(this.form).then(response => {
+                                this.myloading.close()
+                                if (response.code === 200) {
+                                    this.msgSuccess(response.msg);
+                                    
+                                    this.$emit('close');
+                                }
+                                else{
+                                    this.msgError(response.msg);
+                                }
+                            });
+                        }
+                        
                     }
                 });
             },

+ 1 - 1
src/views/crm/components/customerDetails.vue

@@ -325,7 +325,7 @@
                 this.addSms.open=true;
                 var that=this;
                 setTimeout(() => {
-                    that.$refs.sms.reset(this.item.customerId,mobile);
+                    that.$refs.sms.reset(this.item.customerId,mobile,1);
                 }, 500);
                 
             },

+ 22 - 2
src/views/store/components/productOrder.vue

@@ -66,7 +66,8 @@
                 <span v-if="order!=null ">
                   {{order.userPhone }}
                 </span>
-                <el-button type="text" size="mini" @click="callNumber(null,null,order.orderId)">拨号</el-button>
+                <el-button type="text" size="mini" @click="callNumber(0,0,orderId)"  v-hasPermi="['store:storeOrder:callNumber']">拨号</el-button>
+                <el-button type="text" size="mini" @click="handleSms(order.userPhone)" v-hasPermi="['store:storeOrder:sendSms']">短信</el-button>
             </el-descriptions-item>
             <el-descriptions-item label="收货地址"  >
               <el-popover
@@ -448,6 +449,9 @@
       >
         <customer-details  ref="customerDetails" />
     </el-drawer>
+    <el-dialog :title="addSms.title" :visible.sync="addSms.open" width="800px" append-to-body>
+        <add-sms ref="sms" @close="closeSms()"></add-sms>
+    </el-dialog>
   </div>
 </template>
 
@@ -460,10 +464,11 @@ import Material from '@/components/Material'
 import {bindCustomer,getExpress, listStoreOrder, getStoreOrder, delStoreOrder, addStoreOrder, updateStoreOrder, exportStoreOrder,uploadCredentials, getStoreOrderAddress} from "@/api/store/storeOrder";
 import {getAllList} from "@/api/store/city";
 import customerDetails from '../../crm/components/customerDetails.vue';
+import addSms from '../../crm/components/addSms.vue';
 export default {
   name: "order",
   components: {customerDetails,
-    ImageUpload,Material },
+    ImageUpload,Material ,addSms},
   data() {
     return {
       scheduleOptions:[],
@@ -482,6 +487,10 @@ export default {
         orderCode:null,
         certificates:null,
       },
+      addSms:{
+        open:false,
+        title:"发短信"
+      },
       certificateRules:{
         certificates:[
           { required: true, message: "凭证不能为空", trigger: "change" }
@@ -578,6 +587,17 @@ export default {
     });
   },
   methods: {
+    closeSms(){
+      this.addSms.open=false;
+    },
+    handleSms(mobile){
+        this.addSms.open=true;
+        var that=this;
+        setTimeout(() => {
+            that.$refs.sms.getOrderId(this.orderId,mobile,2);
+        }, 500);
+        
+    },
     handleAddress(){
       const id = this.order.id;
       getStoreOrderAddress(id).then(response =>{