Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

yuhongqi 13 часов назад
Родитель
Сommit
d3150c39f9

+ 319 - 0
src/views/components/order/createOder.vue

@@ -0,0 +1,319 @@
+<template>
+  <div>
+    <el-dialog :title="title" v-if="open" :visible.sync="open" width="1000px" append-to-body :close-on-click-modal="false">
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
+        <el-form-item label="会员信息">
+          <el-table border style="margin-top:5px;" v-loading="userloading" :data="users">
+            <el-table-column label="ID" align="center" prop="userId" />
+            <el-table-column label="会员头像" align="center" width="80">
+              <template slot-scope="scope">
+                <el-popover placement="right" title="" trigger="hover">
+                  <img slot="reference" :src="scope.row.avatar" width="50">
+                  <img :src="scope.row.avatar" style="max-width: 120px;">
+                </el-popover>
+              </template>
+            </el-table-column>
+            <el-table-column label="昵称" align="center" prop="nickName" />
+            <el-table-column label="手机号" align="center" prop="phone" />
+            <el-table-column label="状态" align="center" prop="status">
+              <template slot-scope="scope">
+                <el-tag
+                  v-for="(item, index) in userStatusOptions"
+                  v-if="scope.row.status == item.dictValue"
+                  :key="index"
+                >{{ item.dictLabel }}</el-tag>
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-form-item>
+        <el-form-item label="收货信息" prop="addressId">
+          <el-row>
+            <el-col>
+              <el-button plain type="primary" icon="el-icon-plus" @click="handleAddUserAddress">添加收货地址</el-button>
+            </el-col>
+          </el-row>
+          <el-radio-group v-model="form.addressId" style="width:100%">
+            <el-table border style="margin-top:5px;" v-loading="addressloading" :data="address">
+              <el-table-column label="ID" align="center">
+                <template slot-scope="scope">
+                  <el-radio :label="scope.row.addressId"></el-radio>
+                </template>
+              </el-table-column>
+              <el-table-column label="收货人姓名" align="center" prop="realName" />
+              <el-table-column label="收货人电话" align="center" prop="phone" />
+              <el-table-column label="地址" align="center" prop="detail">
+                <template slot-scope="scope">
+                  {{ scope.row.province }} {{ scope.row.city }} {{ scope.row.district }} {{ scope.row.detail }}
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="商品列表">
+          <el-row>
+            <el-col>
+              <el-button plain type="primary" icon="el-icon-plus" @click="handleAddProduct">添加商品</el-button>
+            </el-col>
+          </el-row>
+          <el-table border :key="tablekey" width="100%" style="margin-top:5px;" :data="products">
+            <el-table-column label="商品编号" align="center" prop="barCode" />
+            <el-table-column label="商品图片" align="center" width="100">
+              <template slot-scope="scope">
+                <el-popover placement="right" title="" trigger="hover">
+                  <img slot="reference" :src="scope.row.image" width="50">
+                  <img :src="scope.row.image" style="max-width: 50px;">
+                </el-popover>
+              </template>
+            </el-table-column>
+            <el-table-column label="商品名称" show-overflow-tooltip align="center" prop="productName" />
+            <el-table-column label="商品规格" align="center" prop="sku" />
+            <el-table-column label="库存" align="center" prop="stock" />
+            <el-table-column label="单价" align="center" prop="price" />
+            <el-table-column label="数量" align="center" prop="count" width="200px" :key="tablekey">
+              <template slot-scope="scope">
+                <div>
+                  <el-input-number
+                    v-model="scope.row.count"
+                    @change="handleProductCountChange(scope.row)"
+                    size="mini"
+                    :min="1"
+                    :max="scope.row.stock"
+                  ></el-input-number>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="小计" align="center" prop="money" />
+            <el-table-column label="操作" align="center" width="100px">
+              <template slot-scope="scope">
+                <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDeleteProduct(scope.row)">删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <el-row>
+            <el-col>
+              <span>商品合计:{{ products.length }}</span>
+              <span style="margin-left:10px;">商品总价:{{ totalMoney.toFixed(2) }}</span>
+            </el-col>
+          </el-row>
+        </el-form-item>
+        <el-form-item label="支付方式" prop="payType">
+          <el-select v-model="form.payType" placeholder="请选择支付方式" clearable size="small">
+            <el-option
+              v-for="item in payTypeOptions"
+              :key="item.dictValue"
+              :label="item.dictLabel"
+              :value="item.dictValue"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="改价" prop="payPrice">
+          <el-input-number v-model="form.payPrice" placeholder="修改商品总价" size="medium" :precision="2" :min="0.01" :step="0.1" />
+        </el-form-item>
+        <el-form-item label="物流代收" prop="amount" v-if="form.payType == '3'">
+          <el-input-number v-model="form.amount" placeholder="平台支付价格" size="medium" :precision="2" :min="0.01" :step="0.1" />
+        </el-form-item>
+        <el-form-item label="订单备注" prop="mark">
+          <el-input type="textarea" rows="2" v-model="form.mark" placeholder="" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog :title="product.title" v-if="product.open" :visible.sync="product.open" width="1000px" append-to-body>
+      <product-select @selectProduct="selectProduct" />
+    </el-dialog>
+    <el-dialog :title="userAddress.title" v-if="userAddress.open" :visible.sync="userAddress.open" width="800px" append-to-body>
+      <add-user-address ref="addUserAddress" @addUserAddress="onAddUserAddress" />
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { createUserOrder } from '@/api/hisStore/storeOrder';
+import { userList } from '@/api/store/user';
+import { getAddressList } from '@/api/users/userAddress';
+import productSelect from '@/views/hisStore/components/productSelect';
+import addUserAddress from '@/views/hisStore/components/addUserAddress';
+
+export default {
+  name: 'CreateOder',
+  components: { productSelect, addUserAddress },
+  data() {
+    return {
+      open: false,
+      title: '创建订单',
+      form: {
+        addressId: null,
+        userId: null,
+        products: [],
+        payType: null,
+        payPrice: null,
+        amount: null,
+        mark: null,
+      },
+      rules: {
+        addressId: [{ required: true, message: '收货信息不能为空' }],
+        payType: [{ required: true, message: '支付方式不能为空' }],
+      },
+      users: [],
+      userloading: false,
+      userStatusOptions: [],
+      address: [],
+      addressloading: false,
+      products: [],
+      product: {
+        open: false,
+        title: '商品选择',
+      },
+      userAddress: {
+        open: false,
+        title: '创建收货地址',
+      },
+      tablekey: false,
+      totalMoney: 0,
+      payTypeOptions: [],
+    };
+  },
+  created() {
+    this.getDicts('store_pay_type').then(response => {
+      this.payTypeOptions = response.data;
+    });
+    this.getDicts('user_status').then(response => {
+      this.userStatusOptions = response.data;
+    });
+  },
+  methods: {
+    /** 由父组件调用,row 需包含 fsUserId */
+    show(row) {
+      if (!row || !row.fsUserId) {
+        return;
+      }
+      this.reset();
+      this.open = true;
+      this.title = '创建订单';
+      this.form.userId = row.fsUserId;
+      this.loadUserList(row.fsUserId);
+    },
+    reset() {
+      this.form = {
+        addressId: null,
+        userId: null,
+        products: [],
+        payType: null,
+        payPrice: null,
+        amount: null,
+        mark: null,
+      };
+      this.users = [];
+      this.address = [];
+      this.products = [];
+      this.totalMoney = 0;
+      if (this.$refs.form) {
+        this.resetForm('form');
+      }
+    },
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    loadUserList(userId) {
+      this.userloading = true;
+      this.users = [];
+      this.address = [];
+      userList({ userId: userId }).then(response => {
+        const list = response.rows || response.data || [];
+        this.users = Array.isArray(list) ? list : [list];
+        this.userloading = false;
+        if (this.users.length > 0) {
+          this.form.userId = this.users[0].userId || userId;
+          this.getAddressList(this.form.userId);
+        }
+      }).catch(() => {
+        this.userloading = false;
+      });
+    },
+    getAddressList(userId) {
+      const data = { userId: userId };
+      this.addressloading = true;
+      this.address = [];
+      getAddressList(data).then(response => {
+        this.address = response.data || response.rows || [];
+        this.addressloading = false;
+      }).catch(() => {
+        this.addressloading = false;
+      });
+    },
+    handleAddUserAddress() {
+      if (this.form.userId == null) {
+        this.msgError('请选择会员');
+        return;
+      }
+      this.userAddress.open = true;
+      setTimeout(() => {
+        this.$refs.addUserAddress.init(this.form.userId);
+      }, 500);
+    },
+    onAddUserAddress() {
+      this.userAddress.open = false;
+      this.getAddressList(this.form.userId);
+    },
+    handleAddProduct() {
+      this.product.open = true;
+    },
+    compute() {
+      this.totalMoney = 0;
+      const that = this;
+      this.products.forEach(function(value) {
+        that.totalMoney += value.money;
+      });
+    },
+    handleProductCountChange(row) {
+      this.tablekey = !this.tablekey;
+      row.money = row.count * row.price;
+      this.$forceUpdate();
+      this.compute();
+    },
+    selectProduct(row) {
+      for (let i = 0; i < this.products.length; i++) {
+        if (this.products[i].id == row.id) {
+          return;
+        }
+      }
+      row.count = 1;
+      row.money = row.count * row.price;
+      this.products.push(row);
+      this.$message.success('商品' + row.productName + '添加成功');
+      this.compute();
+    },
+    handleDeleteProduct(row) {
+      this.products.splice(this.products.findIndex(item => item.id === row.id), 1);
+      this.compute();
+    },
+    submitForm() {
+      this.$refs.form.validate(valid => {
+        if (this.products.length === 0) {
+          this.msgError('请选择商品');
+          return;
+        }
+        if (!this.form.userId) {
+          this.msgError('会员信息不能为空');
+          return;
+        }
+        this.form.products = this.products;
+        if (valid) {
+          createUserOrder(this.form).then(response => {
+            if (response.code === 200) {
+              this.msgSuccess('创建成功');
+              this.open = false;
+              this.reset();
+              this.$emit('success');
+            }
+          });
+        }
+      });
+    },
+  },
+};
+</script>

+ 16 - 1
src/views/qw/externalContact/index.vue

@@ -550,6 +550,14 @@
       </el-table-column>
       <el-table-column label="修改" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
         <template slot-scope="scope">
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-shopping-bag-2"
+              :disabled="!scope.row.fsUserId"
+              @click="handleCreateOrder(scope.row)"
+
+            >制单</el-button>
           <el-button
             v-if="scope.row.status==0||scope.row.status==2"
             size="mini"
@@ -1042,6 +1050,9 @@
 	  <collection   ref="collection" />
 	</el-dialog>
 
+    <!--  制单页面组件    -->
+    <create-oder ref="createOder" />
+
   <el-dialog title="修改客户状态" :visible.sync="statusDialog.open" width="500px" append-to-body>
     <el-form ref="statusForm" :model="statusForm" :rules="statusRules" label-width="100px">
       <el-form-item label="状态" prop="status">
@@ -1096,9 +1107,10 @@ import userDetails from '@/views/store/components/userDetails.vue';
 import {courseList, videoList} from "@/api/course/courseRedPacketLog";
 import Collection from './collection.vue';
 import customerDetail from './customerDetail.vue';
+import createOder from '@/views/components/order/createOder.vue';
 export default {
   name: "ExternalContact",
-  components:{PaginationMore, mycustomer,customerDetails,customerDetail,SopDialog,selectUser,info,userDetails,collection},
+  components:{PaginationMore, mycustomer,customerDetails,customerDetail,SopDialog,selectUser,info,userDetails,collection,createOder},
   data() {
     return {
       projectOptions: [],
@@ -1404,6 +1416,9 @@ export default {
 
   },
   methods: {
+    handleCreateOrder(row) {
+      this.$refs.createOder.show(row);
+    },
     shortenText(text, maxLen = 16) {
       const str = text == null ? '' : String(text);
       if (str.length <= maxLen) return str;

+ 118 - 2
src/views/qw/externalContact/myExternalContact.vue

@@ -11,6 +11,7 @@
                 />
               </el-select>
       </el-form-item>
+
       <el-form-item label="企微客户ID" prop="id">
         <el-input
           v-model="queryParams.id"
@@ -517,8 +518,25 @@
           </el-tag>
         </template>
       </el-table-column>
+      <el-table-column label="重粉记录" align="center" width="100px" fixed="right">
+        <template slot-scope="scope">
+            <el-button
+                size="mini"
+                type="text"
+                @click="showRepeatRecord(scope.row)"
+            >重粉记录</el-button>
+        </template>
+      </el-table-column>
       <el-table-column label="修改" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
         <template slot-scope="scope">
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-shopping-bag-2"
+              :disabled="!scope.row.fsUserId"
+              @click="handleCreateOrder(scope.row)"
+
+            >制单</el-button>
           <el-button
             v-show="scope.row.status==0||scope.row.status==2"
             size="mini"
@@ -1021,6 +1039,52 @@
       </div>
     </el-drawer>
 
+    <!-- 重粉记录 -->
+    <el-drawer title="重粉记录" :visible.sync="repeatRecord.open" size="75%" append-to-body>
+      <div style="padding: 10px">
+        <el-form :model="repeatRecord.queryParams" ref="repeatRecordQueryForm" :inline="true" label-width="110px">
+          <el-form-item label="销售企微ID" prop="qwUserId">
+            <el-input
+              v-model="repeatRecord.queryParams.qwUserId"
+              placeholder="请输入销售企微ID"
+              clearable
+              size="small"
+              @keyup.enter.native="handleQueryRepeatRecord"
+            />
+          </el-form-item>
+          <el-form-item label="销售企微昵称" prop="qwUserName">
+            <el-input
+              v-model="repeatRecord.queryParams.qwUserName"
+              placeholder="请输入销售企微昵称"
+              clearable
+              size="small"
+              @keyup.enter.native="handleQueryRepeatRecord"
+            />
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryRepeatRecord">搜索</el-button>
+            <el-button icon="el-icon-refresh" size="mini" @click="resetRepeatRecordQuery">重置</el-button>
+          </el-form-item>
+        </el-form>
+        <el-table v-loading="repeatRecord.loading" :data="repeatRecord.list" border>
+          <el-table-column label="企微客户ID" align="center" prop="externalUserId" min-width="140" />
+          <el-table-column label="企微客户昵称" align="center" prop="externalUserName" min-width="120" />
+          <el-table-column label="销售企微ID" align="center" prop="qwUserId" min-width="120" />
+          <el-table-column label="销售企微昵称" align="center" prop="qwUserName" min-width="120" />
+          <el-table-column label="企微部门" align="center" prop="deptName" min-width="120" />
+          <el-table-column label="添加时间" align="center" prop="createTime" width="170" />
+          <el-table-column label="注册时间" align="center" prop="registerTime" width="170" />
+        </el-table>
+        <pagination
+          v-show="repeatRecord.total > 0"
+          :total="repeatRecord.total"
+          :page.sync="repeatRecord.queryParams.pageNum"
+          :limit.sync="repeatRecord.queryParams.pageSize"
+          @pagination="repeatRecordList"
+        />
+      </div>
+    </el-drawer>
+
     <el-drawer
         :with-header="false"
         size="75%"
@@ -1063,6 +1127,10 @@
     <el-dialog :title="collection.title" :visible.sync="collection.open"   width="1100px" append-to-body>
 	  <collection   ref="collection" />
 	</el-dialog>
+
+    <!--  制单页面组件    -->
+    <create-oder ref="createOder" />
+
   <el-dialog title="修改客户状态" :visible.sync="statusDialog.open" width="500px" append-to-body>
     <el-form ref="statusForm" :model="statusForm" :rules="statusRules" label-width="100px">
       <el-form-item label="状态" prop="status">
@@ -1102,7 +1170,7 @@ import {
   setCustomerCourseSop,
   getCustomerCourseSop,
   setCustomerCourseSopList,
-  syncMyExternalContact, unBindUserId, updateExternalContactCall,exportMyExternalContact,updateExternalContactStatus,getWatchLogList
+  syncMyExternalContact, unBindUserId, updateExternalContactCall,exportMyExternalContact,updateExternalContactStatus,getWatchLogList,getRepeatRecordList
 } from '@/api/qw/externalContact'
 import info from "@/views/qw/externalContact/info.vue";
 import {getMyQwUserList, getMyQwCompanyList, handleInputAuthAppKey, updateUser} from "@/api/qw/user";
@@ -1121,9 +1189,10 @@ import Collection from './collection.vue';
 import {courseList, videoList} from "@/api/course/courseRedPacketLog";
 import userDetails from '@/views/store/components/userDetails.vue';
 import customerDetail from './customerDetail.vue';
+import createOder from '@/views/components/order/createOder.vue';
 export default {
   name: "ExternalContact",
-  components:{PaginationMore, mycustomer,customerDetails,SopDialog,selectUser,info,Collection,userDetails,customerDetail},
+  components:{PaginationMore, mycustomer,customerDetails,SopDialog,selectUser,info,Collection,userDetails,customerDetail,createOder},
   data() {
     return {
       aiAnalyze: {
@@ -1157,6 +1226,20 @@ export default {
           videoId: null,
         },
       },
+      repeatRecord: {
+        open: false,
+        loading: false,
+        list: [],
+        total: 0,
+        queryParams: {
+          pageNum: 1,
+          pageSize: 10,
+          corpId: null,
+          externalUserId: null,
+          qwUserId: null,
+          qwUserName: null
+        }
+      },
       statusDialog: {
         open: false,
         title: "修改客户状态"
@@ -1459,6 +1542,39 @@ export default {
         this.log.total = e.total;
       });
     },
+    handleCreateOrder(row) {
+      this.$refs.createOder.show(row);
+    },
+    /** 重粉记录 */
+    showRepeatRecord(row) {
+      this.repeatRecord.queryParams.corpId = row.corpId;
+      this.repeatRecord.queryParams.externalUserId = row.externalUserId;
+      this.repeatRecord.queryParams.qwUserId = null;
+      this.repeatRecord.queryParams.qwUserName = null;
+      this.repeatRecord.queryParams.pageNum = 1;
+      this.repeatRecord.queryParams.pageSize = 10;
+      this.repeatRecord.open = true;
+      this.repeatRecordList();
+    },
+    handleQueryRepeatRecord() {
+      this.repeatRecord.queryParams.pageNum = 1;
+      this.repeatRecordList();
+    },
+    resetRepeatRecordQuery() {
+      this.repeatRecord.queryParams.qwUserId = null;
+      this.repeatRecord.queryParams.qwUserName = null;
+      this.repeatRecord.queryParams.pageNum = 1;
+      this.repeatRecordList();
+    },
+    repeatRecordList() {
+      this.repeatRecord.loading = true;
+      getRepeatRecordList(this.repeatRecord.queryParams).then(res => {
+        this.repeatRecord.list = res.rows || [];
+        this.repeatRecord.total = res.total || 0;
+      }).finally(() => {
+        this.repeatRecord.loading = false;
+      });
+    },
     courseChange(row) {
       this.log.queryParams.videoId = null;
       if (row === '') {