|
@@ -6,6 +6,16 @@
|
|
|
<treeselect v-model="queryParams.cateId" style="width:205.4px" :options="categoryOptions" :normalizer="normalizer" placeholder="请选择分类" />
|
|
|
</el-form-item>
|
|
|
|
|
|
+ <el-form-item label="所属店铺" prop="storeId" >
|
|
|
+ <el-select v-model="queryParams.storeId" placeholder="所属店铺" clearable size="small" filterable>
|
|
|
+ <el-option
|
|
|
+ v-for="dict in storeOptions"
|
|
|
+ :key="dict.storeId"
|
|
|
+ :label="dict.storeName"
|
|
|
+ :value="dict.storeId"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="商品名称" prop="productName">
|
|
|
<el-input
|
|
|
v-model="queryParams.productName"
|
|
@@ -212,7 +222,6 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item> -->
|
|
|
-
|
|
|
<el-form-item>
|
|
|
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
@@ -234,7 +243,7 @@
|
|
|
type="success"
|
|
|
icon="el-icon-edit"
|
|
|
size="mini"
|
|
|
- :disabled="multiple"
|
|
|
+ :disabled="single"
|
|
|
@click="handleUpdate"
|
|
|
v-hasPermi="['store:storeProduct:edit']"
|
|
|
>修改</el-button>
|
|
@@ -291,6 +300,7 @@
|
|
|
</el-popover>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="店铺名称" show-overflow-tooltip align="center" prop="storeName" />
|
|
|
<el-table-column label="商品名称" show-overflow-tooltip align="center" prop="productName" />
|
|
|
<el-table-column label="分类" align="center" prop="cateName" />
|
|
|
<el-table-column label="所属公司" align="center" prop="companyName" />
|
|
@@ -382,22 +392,7 @@
|
|
|
</el-dialog>
|
|
|
|
|
|
<!-- 添加或修改商品对话框 -->
|
|
|
- <el-dialog :title="title" v-if="open" :fullscreen="isFullscreen" :visible.sync="open" width="1000px" append-to-body :show-close="false">
|
|
|
- <template v-slot:title>
|
|
|
- <div style="display: flex; justify-content: space-between; align-items: center;">
|
|
|
- <span>{{ title }}</span>
|
|
|
- <div>
|
|
|
- <!-- 全屏按钮 -->
|
|
|
- <el-button type="text" @click="handleFullScreen" size="middle">
|
|
|
- <i class="el-icon-full-screen"></i>
|
|
|
- </el-button>
|
|
|
- <!--关闭按钮-->
|
|
|
- <el-button type="text" @click="open = false">
|
|
|
- <i class="el-icon-close"></i>
|
|
|
- </el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
+ <el-dialog :title="title" v-if="open" :visible.sync="open" width="1000px" append-to-body>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
<el-row >
|
|
|
<el-col :span="12">
|
|
@@ -422,7 +417,6 @@
|
|
|
<el-input v-model="form.unitName" placeholder="请输入单位名" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
</el-row>
|
|
|
<el-row :gutter="10">
|
|
|
<el-col :span="12">
|
|
@@ -537,22 +531,6 @@
|
|
|
<el-form-item label="商品图片" prop="image">
|
|
|
<Material v-model="imageArr" type="image" :num="1" :width="150" :height="150" />
|
|
|
</el-form-item>
|
|
|
-<!-- <el-form-item label="商品视频" prop="video">
|
|
|
- <div>
|
|
|
- <el-upload
|
|
|
- ref="upload"
|
|
|
- class="upload-demo"
|
|
|
- :action="uploadUrl"
|
|
|
- :on-success="handleSuccess"
|
|
|
- :before-upload="beforeUpload"
|
|
|
- :limit="1"
|
|
|
- :accept="videoAccept"
|
|
|
- >
|
|
|
- <el-button size="small" type="primary">点击上传视频</el-button>
|
|
|
- </el-upload>
|
|
|
- <video v-if="form.video" :src="form.video" controls style="max-width: 300px; max-height: 300px; margin-top: 10px"></video>
|
|
|
- </div>
|
|
|
- </el-form-item>-->
|
|
|
<el-form-item label="轮播图" prop="sliderImage">
|
|
|
<Material v-model="photoArr" type="image" :num="10" :width="150" :height="150" />
|
|
|
</el-form-item>
|
|
@@ -566,7 +544,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<!-- 多规格添加-->
|
|
|
- <el-col :span="24" v-if="form.specType === 1" class="noForm" >
|
|
|
+ <el-col :span="24" v-if="form.specType === 1" class="noForm">
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="选择规格:" prop="">
|
|
|
<div class="acea-row row-middle">
|
|
@@ -577,7 +555,6 @@
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
<el-col :span="24">
|
|
|
<el-form-item v-if="attrs!=null&&attrs.length!==0">
|
|
|
<div v-for="(item, index) in attrs" :key="index">
|
|
@@ -594,8 +571,7 @@
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
- <el-col :span="24" v-if="createBnt">
|
|
|
+ <el-col :span="24" v-if="createBnt">
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" size="small" icon="md-add" @click="addBtn" class="mr15">添加新规格</el-button>
|
|
|
<el-button type="success" size="small" @click="generate">立即生成</el-button>
|
|
@@ -622,40 +598,71 @@
|
|
|
<!-- 多规格表格-->
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="商品属性:" class="labeltop">
|
|
|
-
|
|
|
- <el-table :data="manyFormValidate" size="small" style="width: 90%;" border>
|
|
|
+ <el-table :data="manyFormValidate" size="small" style="width: 90%;">
|
|
|
<el-table-column type="myindex" v-for="(item,index) in form.header" :key="index" :width="item.minWidth" :label="item.title" :property="item.slot" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<div v-if="scope.column.property == 'image'" align="center">
|
|
|
<single-img v-model="scope.row[scope.column.property]" type="image" :num="1" :width="60" :height="60" />
|
|
|
</div>
|
|
|
+ <div v-else-if="scope.column.property == 'storeId'" align="center">
|
|
|
+ <el-tag prop="storeId" v-for="(item, index) in storeOptions" v-if="scope.row[scope.column.property]==item.storeId">{{item.storeName}}</el-tag>
|
|
|
+ </div>
|
|
|
<div v-else-if="scope.column.property.indexOf('value') != -1" align="center">
|
|
|
{{ scope.row[scope.column.property] }}
|
|
|
</div>
|
|
|
<div v-else-if="scope.column.property == 'action'" align="center" >
|
|
|
<a @click="delAttrTable(scope.$index)" align="center">删除</a>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- <div v-else-if="scope.column.property == 'storeId'" align="center" >
|
|
|
+ <el-select v-model="scope.row.storeId" disabled clearable size="small" filterable>
|
|
|
+ <el-option
|
|
|
+ v-for="dict in storeOptions"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictLabel"
|
|
|
+ :value="dict.dictValue"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </div> -->
|
|
|
+
|
|
|
<div v-else align="center">
|
|
|
<el-input v-model="scope.row[scope.column.property]" align="center" />
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
-
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
|
|
|
<!-- 单规格表格-->
|
|
|
- <el-col :xl="23" :lg="24" :md="24" :sm="24" :xs="24" v-if="form.specType === 0" style="">
|
|
|
+ <el-col :xl="23" :lg="24" :md="24" :sm="24" :xs="24" v-if="form.specType === 0">
|
|
|
<el-form-item >
|
|
|
- <el-table :data="oneFormValidate" size="small" border>
|
|
|
+ <el-table border :data="oneFormValidate" size="mini">
|
|
|
<el-table-column prop="image" label="图片" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<single-img v-model="scope.row.image" type="image" :num="1" :width="60" :height="60" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="storeId" label="所属店铺" align="center" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag prop="storeId" v-for="(item, index) in storeOptions" v-if="scope.row.storeId==item.storeId">{{item.storeName}}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <!-- <el-table-column prop="erpSkuName" label="erp-sku名称" width="150px" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input type="text" v-model="scope.row.erpSkuName"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column> -->
|
|
|
+ <el-table-column prop="erpCode" label="erp编号" width="130px" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input type="text" v-model="scope.row.erpCode"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
<el-table-column prop="price" label="售价" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input type="text" v-model="scope.row.price"/>
|
|
@@ -735,6 +742,16 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <el-form-item label="所属店铺" prop="storeId">
|
|
|
+ <el-select v-model="storeIds" multiple placeholder="请选择" clearable size="small" style="width: 100%;">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in storeOptions"
|
|
|
+ :key="dict.storeId"
|
|
|
+ :label="dict.storeName"
|
|
|
+ :value="dict.storeId"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="商品详情" prop="description">
|
|
|
<editor ref="myeditor" @on-text-change="updateText" />
|
|
|
</el-form-item>
|
|
@@ -814,7 +831,7 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="商品类型" prop="productType">
|
|
|
- <el-select style="width: 240px" v-model="form.productType" placeholder="请选择商品类型" clearable size="small">
|
|
|
+ <el-select style="width: 240px" v-model="form.productType" placeholder="请选择商品类型" clearable size="small" >
|
|
|
<el-option
|
|
|
v-for="item in productTypeOptions"
|
|
|
:key="item.dictValue"
|
|
@@ -907,6 +924,7 @@ import {
|
|
|
import { getAllStoreProductCategory } from "@/api/hisStore/storeProductCategory";
|
|
|
import { getAllStoreProductRule } from "@/api/hisStore/storeProductRule";
|
|
|
import { getAllShippingTemplates } from "@/api/hisStore/shippingTemplates";
|
|
|
+import { getAllStore } from "@/api/hisStore/store";
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
@@ -930,9 +948,56 @@ export default {
|
|
|
photoArr: function(val) {
|
|
|
this.form.sliderImage = val.join(',')
|
|
|
},
|
|
|
- drugImageArr: function(val) {
|
|
|
- this.form.drugImage = val.join(',');
|
|
|
+ storeIds(newVal) {
|
|
|
+ if (newVal.length > 0&&this.form.specType===0) {
|
|
|
+ // 如果oneFormValidate的第一行没有绑定storeId,且已有数据
|
|
|
+ if (this.hasData(this.oneFormValidate[0])) {
|
|
|
+ // 将第一行的storeId绑定为第一个选择的storeId
|
|
|
+ this.oneFormValidate[0].storeId = newVal[0];
|
|
|
+ }
|
|
|
+
|
|
|
+ // 处理其他选中的storeId
|
|
|
+ for (let i = 1; i < newVal.length; i++) {
|
|
|
+ if (this.oneFormValidate[i]) {
|
|
|
+ // 如果有对应的行,更新storeId
|
|
|
+ this.oneFormValidate[i].storeId = newVal[i];
|
|
|
+ } else {
|
|
|
+ // 如果没有对应的行,复制第一行并替换storeId
|
|
|
+ this.oneFormValidate.push({
|
|
|
+ ...this.oneFormValidate[0], // 复制第一行的所有数据
|
|
|
+ storeId: newVal[i] // 更换storeId
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 如果storeIds减少了,删除多余的行
|
|
|
+ if (newVal.length < this.oneFormValidate.length) {
|
|
|
+ this.oneFormValidate.splice(newVal.length);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (newVal.length > 0 && this.form.specType === 1) {
|
|
|
+ if (this.originalElements.length === 0) {
|
|
|
+ // 在第一次操作时,保存初始的manyFormValidate内容
|
|
|
+ this.originalElements = [...this.manyFormValidate];
|
|
|
+ }
|
|
|
+
|
|
|
+ // 清空manyFormValidate,以便重新填充
|
|
|
+ this.manyFormValidate = [];
|
|
|
+
|
|
|
+ // 根据当前storeIds重新生成manyFormValidate
|
|
|
+ newVal.forEach(storeId => {
|
|
|
+ this.originalElements.forEach(element => {
|
|
|
+ this.manyFormValidate.push({
|
|
|
+ ...element,
|
|
|
+ storeId, // 为每个复制的元素绑定不同的storeId
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else if (newVal.length === 0) {
|
|
|
+ // 如果没有选择任何storeId,则重置manyFormValidate为原始内容
|
|
|
+ this.manyFormValidate = [...this.originalElements];
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -955,16 +1020,24 @@ export default {
|
|
|
// 上传的地址
|
|
|
url: process.env.VUE_APP_BASE_API + "/store/storeProduct/importData"
|
|
|
},
|
|
|
- // 添加药品相关字段
|
|
|
- isDrugOptions: [
|
|
|
- { dictValue: "0", dictLabel: "否" },
|
|
|
- { dictValue: "1", dictLabel: "是" }
|
|
|
- ],
|
|
|
-
|
|
|
- // 药品展示图
|
|
|
- drugImageArr: [],
|
|
|
-
|
|
|
+ originalElements: [], // 用于存储原始的元素
|
|
|
+ //根据名字或者单号搜索获取erpSku列表
|
|
|
+ erpSkuList: [],
|
|
|
+ erpSkuStockList: [],
|
|
|
+ // 是否显示Erp-sku弹出层
|
|
|
+ erpSkuOpen:false,
|
|
|
+ // 是否显示Erp-库存弹出层
|
|
|
+ erpSkuStockOpen:false,
|
|
|
+ // 用于存储当前选中的部分数据
|
|
|
+ selectedErpSkuRow:null,
|
|
|
+ storeIds:[],
|
|
|
+ proData:null,
|
|
|
+ //用于存储选择的多规格的那个行数
|
|
|
+ selectedErpSkuRowManyForm:{
|
|
|
+ indexId:null,
|
|
|
+ },
|
|
|
productTuiCateOptions:[],
|
|
|
+ erpSkuStatusOptions:[],
|
|
|
showIput: false,
|
|
|
createBnt:true,
|
|
|
// 规格数据
|
|
@@ -984,7 +1057,11 @@ export default {
|
|
|
// 单规格表格data
|
|
|
oneFormValidate: [
|
|
|
{
|
|
|
+ storeId:null,
|
|
|
+ id:'',
|
|
|
image: '',
|
|
|
+ erpCode:'',
|
|
|
+ erpSkuName:'',
|
|
|
price: 0,
|
|
|
cost: 0,
|
|
|
agentPrice: 0,
|
|
@@ -1012,10 +1089,12 @@ export default {
|
|
|
storeOptions:[],
|
|
|
// 遮罩层
|
|
|
loading: true,
|
|
|
+ erpSkuLoading: true,
|
|
|
+ erpSkuStockLoading: true,
|
|
|
// 选中数组
|
|
|
ids: [],
|
|
|
// 非单个禁用
|
|
|
- single: false,
|
|
|
+ single: true,
|
|
|
// 非多个禁用
|
|
|
multiple: true,
|
|
|
// 显示搜索条件
|
|
@@ -1023,13 +1102,19 @@ export default {
|
|
|
isFullscreen: false,
|
|
|
// 总条数
|
|
|
total: 0,
|
|
|
+ //erpSku总条数
|
|
|
+ erpSkuTotal:0,
|
|
|
+
|
|
|
+ //erpSkuStock总条数
|
|
|
+ erpSkuStockTotal:0,
|
|
|
+
|
|
|
// 商品表格数据
|
|
|
storeProductList: [],
|
|
|
// 弹出层标题
|
|
|
title: "",
|
|
|
// 是否显示弹出层
|
|
|
open: false,
|
|
|
-
|
|
|
+ pageSizes: [10, 20, 30, 50,100,500 ],
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
@@ -1055,6 +1140,21 @@ export default {
|
|
|
contraindications: null,
|
|
|
precautions: null
|
|
|
},
|
|
|
+
|
|
|
+ // 查询参数
|
|
|
+ queryParamsErpSku: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ erpCode: null,
|
|
|
+ erpSkuName: null,
|
|
|
+ },
|
|
|
+ // 查询参数
|
|
|
+ queryParamsErpStockSku: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ erpCode: null,
|
|
|
+ erpSkuName: null,
|
|
|
+ },
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
// 表单校验
|
|
@@ -1098,36 +1198,18 @@ export default {
|
|
|
companyIds: [
|
|
|
{ required: true, message: "销售公司不能为空", trigger: "blur" }
|
|
|
],
|
|
|
- // 药品相关字段校验(仅在是药品时必填)
|
|
|
- drugImage: [
|
|
|
- { required: true, message: "药品展示图不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- drugRegCertNo: [
|
|
|
- { required: true, message: "药品注册证书编号不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- commonName: [
|
|
|
- { required: true, message: "通用名称不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- dosageForm: [
|
|
|
- { required: true, message: "剂型不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- unitPrice: [
|
|
|
- { required: true, message: "单价不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- batchNumber: [
|
|
|
- { required: true, message: "批号不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- mah: [
|
|
|
- { required: true, message: "上市许可持有人不能为空", trigger: "blur" }
|
|
|
+
|
|
|
+ usageMethod: [
|
|
|
+ { required: true, message: "使用方法不能为空", trigger: "blur" }
|
|
|
],
|
|
|
- mahAddress: [
|
|
|
- { required: true, message: "上市许可持有人地址不能为空", trigger: "blur" }
|
|
|
+ dosaNum: [
|
|
|
+ { required: true, message: "每次用药数量不能为空", trigger: "blur" }
|
|
|
],
|
|
|
- manufacturer: [
|
|
|
- { required: true, message: "生产企业不能为空", trigger: "blur" }
|
|
|
+ dosaUnit: [
|
|
|
+ { required: true, message: "每次用药单位不能为空", trigger: "blur" }
|
|
|
],
|
|
|
- manufacturerAddress: [
|
|
|
- { required: true, message: "生产企业地址不能为空", trigger: "blur" }
|
|
|
+ frequency: [
|
|
|
+ { required: true, message: "用药频次不能为空", trigger: "blur" }
|
|
|
],
|
|
|
indications: [
|
|
|
{ required: true, message: "功能主治不能为空", trigger: "blur" }
|
|
@@ -1147,6 +1229,8 @@ export default {
|
|
|
storeId :[
|
|
|
{ required: true, message: "所属店铺不能为空", trigger: "blur"}
|
|
|
]
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
};
|
|
|
},
|
|
@@ -1160,7 +1244,6 @@ export default {
|
|
|
this.isHotOptions = response.data;
|
|
|
this.isGoodOptions=response.data;
|
|
|
this.isDisplayOptions=response.data;
|
|
|
- console.log(response.data)
|
|
|
});
|
|
|
this.getDicts("store_product_type").then((response) => {
|
|
|
this.productTypeOptions = response.data;
|
|
@@ -1168,6 +1251,9 @@ export default {
|
|
|
this.getDicts("store_product_is_show").then((response) => {
|
|
|
this.isShowOptions = response.data;
|
|
|
});
|
|
|
+ this.getDicts("sys_erp_sku_status").then((response) => {
|
|
|
+ this.erpSkuStatusOptions = response.data;
|
|
|
+ });
|
|
|
getAllShippingTemplates().then(response => {
|
|
|
this.templateList =response.data;
|
|
|
});
|
|
@@ -1182,6 +1268,7 @@ export default {
|
|
|
});
|
|
|
this.getTreeselect();
|
|
|
this.getList();
|
|
|
+ this.getStoreList();
|
|
|
},
|
|
|
methods: {
|
|
|
cancel1(){
|
|
@@ -1257,6 +1344,15 @@ export default {
|
|
|
this.download(response.msg);
|
|
|
});
|
|
|
},
|
|
|
+ hasData(row) {
|
|
|
+ // 判断某行是否有数据(除了storeId以外的字段)
|
|
|
+ return Object.keys(row).some(key => key !== 'storeId' && row[key] !== '' && row[key] !== 0);
|
|
|
+ },
|
|
|
+ getStoreList() {
|
|
|
+ getAllStore().then(response => {
|
|
|
+ this.storeOptions = response.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
// 删除表格中的属性
|
|
|
delAttrTable (index) {
|
|
|
this.manyFormValidate.splice(index, 1);
|
|
@@ -1268,7 +1364,7 @@ export default {
|
|
|
},
|
|
|
//生成SKU
|
|
|
generate () {
|
|
|
- genFormatAttr(this.form.productId, { attrs: this.attrs }).then(res => {
|
|
|
+ genFormatAttr(this.form.productId, { attrs: JSON.stringify(this.attrs) ,stores:this.storeIds }).then(res => {
|
|
|
if(this.form.specType === 0){
|
|
|
this.oneFormValidate = res.value;
|
|
|
this.form.header = res.header;
|
|
@@ -1406,15 +1502,140 @@ export default {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
+ /** 查询erpSku库存列表 */
|
|
|
+ getErpSkuStock(){
|
|
|
+ this.erpSkuStockLoading=true;
|
|
|
+ getERPSkuStockList(this.queryParamsErpStockSku).then(response => {
|
|
|
+ this.erpSkuStockList = response.data.Rows;
|
|
|
+ this.erpSkuStockTotal = response.data.Total;
|
|
|
+ this.erpSkuStockLoading = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ //搜索Erp-Sku商品库存信息
|
|
|
+ searchFormErpSkuStock(){
|
|
|
+ this.queryParamsErpStockSku.pageNum=1;
|
|
|
+ this.getErpSkuStock();
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ /** 查询erpSku列表 */
|
|
|
+ getErpSku(){
|
|
|
+ this.erpSkuLoading=true;
|
|
|
+ getERPSkuList(this.queryParamsErpSku).then(response => {
|
|
|
+ this.erpSkuList = response.data.Rows;
|
|
|
+ this.erpSkuTotal = response.data.Total;
|
|
|
+ this.erpSkuLoading = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ //搜索Erp-Sku商品信息
|
|
|
+ searchFormErpSku(){
|
|
|
+ this.queryParamsErpSku.pageNum=1;
|
|
|
+ this.getErpSku();
|
|
|
+ },
|
|
|
+
|
|
|
+ //换绑
|
|
|
+ changeErpSku(erpCode,index){
|
|
|
+ this.queryParamsErpSku.erpCode=erpCode;
|
|
|
+ if (this.form.specType==0){
|
|
|
+ this.erpSkuOpen = true;
|
|
|
+ this.title="绑定Erp-Sku商品编码";
|
|
|
+ this.getErpSku();
|
|
|
+ }else {
|
|
|
+ this.selectedErpSkuRowManyForm.indexId=index;
|
|
|
+ this.erpSkuOpen = true;
|
|
|
+ this.title="绑定Erp-Sku商品编码";
|
|
|
+ this.getErpSku();
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ //同步库存
|
|
|
+ changeErpSkuStock(erpCode){
|
|
|
+ //this.queryParamsErpSku.pageNum=1;
|
|
|
+ this.erpSkuStockOpen=true;
|
|
|
+ this.title="绑定Erp-Sku商品库存";
|
|
|
+ this.queryParamsErpStockSku.erpCode=erpCode;
|
|
|
+ this.getErpSkuStock();
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
|
this.open = false;
|
|
|
this.reset();
|
|
|
},
|
|
|
+ // 取消Erp-Sku按钮
|
|
|
+ erpSkuCancel(){
|
|
|
+ this.erpSkuOpen = false;
|
|
|
+ },
|
|
|
+ //换绑操作
|
|
|
+ erpSkuConfirmBind() {
|
|
|
+ if(this.selectedErpSkuRow==null){
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ message: '请选择erp商品'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //延时一点点,防止第一次点击过快时 选择未赋值上
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$confirm(`确定要将\n\r商品编码/货号:${this.selectedErpSkuRow.wareid}\n\r品名:${this.selectedErpSkuRow.warename}\n\r绑定到当前商品吗?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true // 居中显示
|
|
|
+ }).then(() => {
|
|
|
+ // 用户点击确定后的逻辑
|
|
|
+ this.erpSkuHandleBind();
|
|
|
+ }).catch(() => {
|
|
|
+ // 用户点击取消后的逻辑
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消换绑操作'
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ }, 200);
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ erpSkuHandleBind() {
|
|
|
+ if (this.form.specType==0){
|
|
|
+ this.oneFormValidate[0].erpCode=this.selectedErpSkuRow.wareid
|
|
|
+ this.oneFormValidate[0].erpSkuName=this.selectedErpSkuRow.warename
|
|
|
+ this.oneFormValidate[0].stock=this.selectedErpSkuRow.ku
|
|
|
+ // 操作完成后,可以给用户一个提示
|
|
|
+ this.$message.success('当前已替换,请在修改页面确认后生效!');
|
|
|
+ this.erpSkuOpen=false
|
|
|
+ }else if (this.form.specType==1) {
|
|
|
+ this.manyFormValidate[this.selectedErpSkuRowManyForm.indexId].erpCode=this.selectedErpSkuRow.wareid
|
|
|
+ this.manyFormValidate[this.selectedErpSkuRowManyForm.indexId].erpSkuName=this.selectedErpSkuRow.warename
|
|
|
+ this.manyFormValidate[this.selectedErpSkuRowManyForm.indexId].stock=this.selectedErpSkuRow.ku
|
|
|
+ this.$message.success('当前已替换,请在修改页面确认后生效!');
|
|
|
+ this.erpSkuOpen=false
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ //取消Erp-Sku搜索
|
|
|
+ erpSkuCancelSearch(){
|
|
|
+ this.queryParamsErpSku.pageNum=1;
|
|
|
+ this.queryParamsErpSku.pageSize=10;
|
|
|
+ this.queryParamsErpSku.erpCode=null;
|
|
|
+ this.queryParamsErpSku.erpSkuName=null;
|
|
|
+ this.selectedErpSkuRow.wareid=null;
|
|
|
+ this.selectedErpSkuRow.warename=null;
|
|
|
+ this.getErpSku();
|
|
|
+ },
|
|
|
// 表单重置
|
|
|
reset() {
|
|
|
this.form = {
|
|
|
- productId: null,
|
|
|
+ productId: 0,
|
|
|
+ storeId:null,
|
|
|
image: null,
|
|
|
video: null,
|
|
|
sliderImage: null,
|
|
@@ -1472,13 +1693,18 @@ export default {
|
|
|
dosage: null, // 用法用量
|
|
|
adverseReactions: null, // 不良反应
|
|
|
contraindications: null, // 禁忌
|
|
|
- precautions: null // 注意事项
|
|
|
+ precautions: null, // 注意事项
|
|
|
+ isShowDetails:"1",
|
|
|
+ usageMethod:"",
|
|
|
+ dosaNum:null,
|
|
|
+ dosaUnit:"",
|
|
|
+ frequency:"",
|
|
|
+ icdName:""
|
|
|
};
|
|
|
- // 重置药品展示图
|
|
|
- this.drugImageArr = [];
|
|
|
this.resetForm("form");
|
|
|
this.oneFormValidate = [
|
|
|
{
|
|
|
+ id:'',
|
|
|
image: '',
|
|
|
price: 0,
|
|
|
agentPrice: 0,
|
|
@@ -1486,6 +1712,8 @@ export default {
|
|
|
otPrice: 0,
|
|
|
stock: 0,
|
|
|
barCode: '',
|
|
|
+ erpCode:'',
|
|
|
+ erpSkuName:'',
|
|
|
weight: 0,
|
|
|
volume: 0,
|
|
|
integral: 0,
|
|
@@ -1514,6 +1742,35 @@ export default {
|
|
|
this.single = selection.length!==1
|
|
|
this.multiple = !selection.length
|
|
|
},
|
|
|
+
|
|
|
+ getRowKeys(row) {
|
|
|
+ // 返回每行的唯一键,通常是ID
|
|
|
+ return row.wareid;
|
|
|
+ },
|
|
|
+ handleSelect(selection, row) {
|
|
|
+ // 当用户选择一行时,取消选择其他行
|
|
|
+ if (selection.length > 0 && this.selectedErpSkuRow !== row) {
|
|
|
+ this.$refs.erpTable.clearSelection();
|
|
|
+ this.$refs.erpTable.toggleRowSelection(row, true);
|
|
|
+ this.selectedErpSkuRow = row;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //Erp-sku绑定选择
|
|
|
+ handleSelectionChangeErpSku(selection){
|
|
|
+ console.log("qxj handleSelectionChangeErpSku:"+JSON.stringify(selection));
|
|
|
+ if (selection.length > 0) {
|
|
|
+ const row=selection[0];
|
|
|
+ this.selectedErpSkuRow = row;
|
|
|
+ //选择的数据存起来
|
|
|
+ // this.selectedErpSkuRow.wareid=row.wareid
|
|
|
+ // this.selectedErpSkuRow.warename=row.warename
|
|
|
+ // this.selectedErpSkuRow.ku=row.ku
|
|
|
+ } else {
|
|
|
+ this.selectedErpSkuRow = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
|
this.reset();
|
|
@@ -1536,14 +1793,49 @@ export default {
|
|
|
this.reset();
|
|
|
const productId = row.productId || this.ids
|
|
|
getStoreProduct(productId).then(response => {
|
|
|
+ this.proData=response;
|
|
|
this.form = response.data;
|
|
|
- this.form.isShow = response.data.isShow.toString();
|
|
|
- this.form.isHot = response.data.isHot.toString();
|
|
|
- this.form.isGood = response.data.isGood.toString();
|
|
|
- this.form.isBest = response.data.isBest.toString();
|
|
|
- this.form.isNew = response.data.isNew.toString();
|
|
|
- this.form.productType = response.data.productType.toString();
|
|
|
- this.form.isDisplay = response.data.isDisplay.toString();
|
|
|
+ if( response.data.isShow){
|
|
|
+ this.form.isShow = response.data.isShow.toString();
|
|
|
+ } else {
|
|
|
+ this.form.isShow = null
|
|
|
+ }
|
|
|
+ if( response.data.isHot){
|
|
|
+ this.form.isHot = response.data.isHot.toString();
|
|
|
+ } else {
|
|
|
+ this.form.isHot = null
|
|
|
+ }
|
|
|
+ if( response.data.isGood){
|
|
|
+ this.form.isGood = response.data.isGood.toString();
|
|
|
+ } else {
|
|
|
+ this.form.isGood = null
|
|
|
+ }
|
|
|
+ if( response.data.isBest){
|
|
|
+ this.form.isBest = response.data.isBest.toString();
|
|
|
+ } else {
|
|
|
+ this.form.isBest = null
|
|
|
+ }
|
|
|
+ if( response.data.isNew){
|
|
|
+ this.form.isNew = response.data.isNew.toString();
|
|
|
+ } else {
|
|
|
+ this.form.isNew = null
|
|
|
+ }
|
|
|
+ if( response.data.productType){
|
|
|
+ this.form.productType = response.data.productType.toString();
|
|
|
+ } else {
|
|
|
+ this.form.productType = null
|
|
|
+ }
|
|
|
+ if( response.data.isDisplay){
|
|
|
+ this.form.isDisplay = response.data.isDisplay.toString();
|
|
|
+ } else {
|
|
|
+ this.form.isDisplay = null
|
|
|
+ }
|
|
|
+ if( response.data.isShowDetails){
|
|
|
+ this.form.isShowDetails = response.data.isShowDetails.toString();
|
|
|
+ } else {
|
|
|
+ this.form.isShowDetails = null
|
|
|
+ }
|
|
|
+
|
|
|
if(this.form.tuiCateId!=null){
|
|
|
this.form.tuiCateId = response.data.tuiCateId.toString();
|
|
|
}
|
|
@@ -1551,20 +1843,24 @@ export default {
|
|
|
this.form.isDrug = response.data.isDrug ? response.data.isDrug.toString() : "1";
|
|
|
if (this.form.drugImage != null) {
|
|
|
this.drugImageArr = this.form.drugImage.split(",");
|
|
|
+ this.storeIds=[];
|
|
|
+ if(this.form.storeId!=null){
|
|
|
+ let storeIds=this.form.storeId.split(",");
|
|
|
+ console.log("qxj storeIds:"+storeIds);
|
|
|
+ storeIds.forEach(item => {
|
|
|
+ this.storeIds.push(parseInt(item));
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
+ this.attrs=[];
|
|
|
//组装attrs数据
|
|
|
- if(response.attrs!=null){
|
|
|
- this.attrs=[];
|
|
|
- response.attrs.forEach(function (item, index) {
|
|
|
- var data={value:item.attrName,detail:item.attrValues.split(',')}
|
|
|
- that.attrs.push(data);
|
|
|
- });
|
|
|
- }
|
|
|
- // 组装companyIds
|
|
|
- if (response.data.companyIds != null && response.data.companyIds != undefined && response.data.companyIds.length > 0) {
|
|
|
- this.form.companyIds = response.data.companyIds.split(',').map(Number);
|
|
|
+ if(this.proData.attrs!=null){
|
|
|
+ this.proData.attrs.forEach(function (item, index) {
|
|
|
+ var data={value:item.attrName,detail:item.attrValues.split(',')}
|
|
|
+ that.attrs.push(data);
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
setTimeout(() => {
|
|
|
that.generate();
|
|
|
}, 200);
|
|
@@ -1574,13 +1870,17 @@ export default {
|
|
|
that.createBnt = true;
|
|
|
that.oneFormValidate = [
|
|
|
{
|
|
|
+ id:'',
|
|
|
image: '',
|
|
|
price: 0,
|
|
|
+ productId:'',
|
|
|
agentPrice: 0,
|
|
|
cost: 0,
|
|
|
otPrice: 0,
|
|
|
stock: 0,
|
|
|
barCode: '',
|
|
|
+ erpCode:'',
|
|
|
+ erpSkuName:'',
|
|
|
weight: 0,
|
|
|
volume: 0,
|
|
|
integral: 0,
|
|
@@ -1622,6 +1922,9 @@ export default {
|
|
|
if(this.form.specType === 1 && this.manyFormValidate.length===0){
|
|
|
return this.$message.warning('请点击生成规格!');
|
|
|
}
|
|
|
+ if(this.storeIds.length>0){
|
|
|
+ this.form.storeId=this.storeIds.join(",");
|
|
|
+ }
|
|
|
// 组装companyIds
|
|
|
if (this.form.companyIds != null && this.form.companyIds != undefined) {
|
|
|
this.form.companyIds = this.form.companyIds.join(',');
|
|
@@ -1636,6 +1939,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
const productIds = row.productId || this.ids;
|
|
@@ -1666,3 +1970,15 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+ /deep/.pagination-container{
|
|
|
+ margin-bottom: 30px;
|
|
|
+ margin-top: 15px;
|
|
|
+ }
|
|
|
+ ::v-deep {
|
|
|
+ .el-dialog:not(.is-fullscreen) {
|
|
|
+ margin-top:0 !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|