|
@@ -0,0 +1,750 @@
|
|
|
+<template>
|
|
|
+ <el-form
|
|
|
+ :model="form"
|
|
|
+ ref="queryForm"
|
|
|
+ size="small"
|
|
|
+ :inline="true"
|
|
|
+ label-width="120px"
|
|
|
+ :rules="rules"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item prop="lookSalesVolume">
|
|
|
+ <span slot="label">展示销量</span>
|
|
|
+ <el-input
|
|
|
+ v-model="form.lookSalesVolume"
|
|
|
+ placeholder="请输入展示销量"
|
|
|
+ clearable
|
|
|
+ @input="passValue"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item prop="giftDesc" label="快递类型">
|
|
|
+ <el-radio
|
|
|
+ v-model="form.expressType"
|
|
|
+ :label="0"
|
|
|
+ :value="0"
|
|
|
+ @change="passValue"
|
|
|
+ >水果特惠</el-radio
|
|
|
+ >
|
|
|
+ <el-radio
|
|
|
+ v-model="form.expressType"
|
|
|
+ :label="1"
|
|
|
+ :value="1"
|
|
|
+ @change="passValue"
|
|
|
+ >生鲜特快</el-radio
|
|
|
+ >
|
|
|
+ <el-radio
|
|
|
+ v-model="form.expressType"
|
|
|
+ :label="2"
|
|
|
+ :value="2"
|
|
|
+ @change="passValue"
|
|
|
+ >京东标快</el-radio
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item prop="unit">
|
|
|
+ <span slot="label">计量单位</span>
|
|
|
+ <el-select
|
|
|
+ v-model="form.unit"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="passValue"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in measure"
|
|
|
+ :key="item.dictLabel"
|
|
|
+ :label="item.dictLabel"
|
|
|
+ :value="item.dictLabel"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item>
|
|
|
+ <span slot="label"><span class="required">*</span> 商品规格</span>
|
|
|
+ <el-button @click="addSpecification" type="primary"
|
|
|
+ >添加规格</el-button
|
|
|
+ >
|
|
|
+ <el-table :data="form.skuList" style="width: 100%; margin-top: 20px">
|
|
|
+ <el-table-column prop="name" label="规格名称" width="140">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.skuSpecsList[0].specsName"
|
|
|
+ placeholder="请输入规格名称"
|
|
|
+ clearable
|
|
|
+ maxlength="8"
|
|
|
+ @input="passValue"
|
|
|
+ show-word-limit
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="address" label="规格内容" width="140">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.skuSpecsList[0].specsValue"
|
|
|
+ placeholder="规格内容"
|
|
|
+ clearable
|
|
|
+ maxlength="8"
|
|
|
+ show-word-limit
|
|
|
+ @input="passValue"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="name" label="预计库存" width="160">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ v-model="scope.row.predictStocks"
|
|
|
+ placeholder="预计库存"
|
|
|
+ clearable
|
|
|
+ @input="passValue"
|
|
|
+ >
|
|
|
+ <template slot="suffix"> {{ form.unit }} </template>
|
|
|
+ </el-input-number>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="name" label="实际库存" width="140">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ v-model="scope.row.stock"
|
|
|
+ placeholder="实际库存"
|
|
|
+ clearable
|
|
|
+ @input="passValue"
|
|
|
+ >
|
|
|
+ <template slot="suffix"> {{ form.unit }} </template>
|
|
|
+ </el-input-number>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="address" label="起批量" width="140">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ v-model="scope.row.skuPriceList[0].minPurchase"
|
|
|
+ placeholder="起批量"
|
|
|
+ clearable
|
|
|
+ @input="passValue"
|
|
|
+ >
|
|
|
+ <template slot="suffix">
|
|
|
+ {{ form.unit }}
|
|
|
+ </template>
|
|
|
+ </el-input-number>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="address" label="收购价" width="140">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ v-model="scope.row.skuCost.purchaseFee"
|
|
|
+ placeholder="收购价"
|
|
|
+ clearable
|
|
|
+ @input="passValue"
|
|
|
+ >
|
|
|
+ <template slot="suffix"> {{ form.unit }}/元 </template>
|
|
|
+ </el-input-number>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="address" label="人工费" width="140">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ v-model="scope.row.skuCost.laborFee"
|
|
|
+ placeholder="人工费"
|
|
|
+ clearable
|
|
|
+ @input="passValue"
|
|
|
+ >
|
|
|
+ <template slot="suffix"> {{ form.unit }}/元 </template>
|
|
|
+ </el-input-number>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="address" label="代办费" width="140">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ v-model="scope.row.skuCost.agencyFee"
|
|
|
+ placeholder="代办费"
|
|
|
+ clearable
|
|
|
+ @input="passValue"
|
|
|
+ >
|
|
|
+ <template slot="suffix"> {{ form.unit }}/元 </template>
|
|
|
+ </el-input-number>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="address" label="材料费" width="140">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ @input="passValue"
|
|
|
+ v-model="scope.row.skuCost.materialFee"
|
|
|
+ placeholder="材料费"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <template slot="suffix"> {{ form.unit }}/元 </template>
|
|
|
+ </el-input-number>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="address" label="商品单价" width="140">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ computePrice(scope.row) }}元/{{ form.unit }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="address" label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ style="color: red"
|
|
|
+ @click="removeSpecification(scope.row, scope.$index)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" style="margin-top: 20px">
|
|
|
+ <el-form-item>
|
|
|
+ <span slot="label"><span class="required">*</span> 商品属性</span>
|
|
|
+ <div class="main">
|
|
|
+ <div style="padding-top: 20px">
|
|
|
+ <el-form-item label="包装方式" prop="packing">
|
|
|
+ <el-select
|
|
|
+ v-model="form.packing"
|
|
|
+ placeholder="请选择包装方式"
|
|
|
+ @change="passValue"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in package"
|
|
|
+ :key="item.dictLabel"
|
|
|
+ :label="item.dictLabel"
|
|
|
+ :value="item.dictLabel"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="shippingTimeDesc">
|
|
|
+ <span slot="label">发货时间</span>
|
|
|
+ <el-select
|
|
|
+ v-model="form.shippingTimeDesc"
|
|
|
+ placeholder="请选择发货时间"
|
|
|
+ @change="passValue"
|
|
|
+ >
|
|
|
+ <el-option label="付款24小时之内" value="付款24小时之内" />
|
|
|
+ <el-option label="付款36小时之内" value="付款36小时之内" />
|
|
|
+ <el-option label="付款48小时之内" value="付款48小时之内" />
|
|
|
+ <el-option label="付款72小时之内" value="付款72小时之内" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-form-item
|
|
|
+ label="自定义属性"
|
|
|
+ v-if="form.props && form.props.length > 0"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ flex-flow: wrap;
|
|
|
+ justify-content: center;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ class="item"
|
|
|
+ v-for="(item, index) in form.props ? form.props : []"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="item.name"
|
|
|
+ placeholder="请输入属性名称"
|
|
|
+ clearable
|
|
|
+ maxlength="8"
|
|
|
+ show-word-limit
|
|
|
+ style="width: 200px"
|
|
|
+ />
|
|
|
+ <el-input
|
|
|
+ v-model="item.value"
|
|
|
+ placeholder="请输入属性值"
|
|
|
+ clearable
|
|
|
+ maxlength="8"
|
|
|
+ show-word-limit
|
|
|
+ @input="passValue"
|
|
|
+ style="width: 200px"
|
|
|
+ />
|
|
|
+ <i
|
|
|
+ class="el-icon-delete"
|
|
|
+ size="22"
|
|
|
+ style="color: red"
|
|
|
+ @click="removeAttribute(item, index)"
|
|
|
+ ></i>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <div class="item1" style="width: 180px">
|
|
|
+ <span @click="addattribute" style="cursor: pointer">
|
|
|
+ <i class="el-icon-plus" size="22"></i>自定义添加商品属性</span
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" v-if="saleModel == 1">
|
|
|
+ <el-form-item prop="merchantClassifyIds">
|
|
|
+ <span slot="label">店铺内所属分类</span>
|
|
|
+ <el-cascader
|
|
|
+ :filterable="true"
|
|
|
+ v-model="form.merchantClassifyIds"
|
|
|
+ ref="formCascader"
|
|
|
+ :placeholder="
|
|
|
+ form.merchantClassifyName
|
|
|
+ ? form.merchantClassifyName
|
|
|
+ : '请选择分类'
|
|
|
+ "
|
|
|
+ :props="categoryprops"
|
|
|
+ @change="cascaderChange"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" style="margin-top: 20px">
|
|
|
+ <el-form-item prop="freeShipping">
|
|
|
+ <span slot="label">运费</span>
|
|
|
+ <div class="main1">
|
|
|
+ <el-radio-group v-model="form.freeShipping" class="radios">
|
|
|
+ <el-radio :label="0" :value="0"
|
|
|
+ >双方协商后卖家进行修改,买家和订单一起支付</el-radio
|
|
|
+ >
|
|
|
+ <el-radio :label="1" :value="1"
|
|
|
+ >全国包邮,由卖家承担运费</el-radio
|
|
|
+ >
|
|
|
+ </el-radio-group>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" style="margin-top: 20px">
|
|
|
+ <el-form-item prop="shippingAddrBean.addrDetail">
|
|
|
+ <span slot="label"> 发货地址</span>
|
|
|
+ <div style="display: flex; flex-direction: row; align-items: center">
|
|
|
+ <el-button
|
|
|
+ @click="selectAddr"
|
|
|
+ type="text"
|
|
|
+ style="
|
|
|
+ font-size: 16px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+ "
|
|
|
+ ><img
|
|
|
+ src="@/assets/images/point.png"
|
|
|
+ style="width: 20px; height: 20px"
|
|
|
+ />
|
|
|
+ 选择地址</el-button
|
|
|
+ >
|
|
|
+ <span style="margin-left: 20px">已选择地址:{{ addr }}</span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-input
|
|
|
+ type="textarea"
|
|
|
+ :rows="3"
|
|
|
+ placeholder="请输入详细地址"
|
|
|
+ v-model="form.shippingAddrBean.addrDetail"
|
|
|
+ style="width: 700px"
|
|
|
+ @blur="passValue"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item prop="shareRate">
|
|
|
+ <span slot="label">分享比例</span>
|
|
|
+ <el-input-number
|
|
|
+ v-model="form.shareRate"
|
|
|
+ :min="0"
|
|
|
+ :max="100"
|
|
|
+ placeholder="请输入分享比例"
|
|
|
+ :controls="false"
|
|
|
+ @change="passValue"
|
|
|
+ >
|
|
|
+ </el-input-number
|
|
|
+ >%
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <Amap ref="mapOpen" @address="Mapaddress"></Amap>
|
|
|
+ </el-form>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { getMerchantClassifyList } from "@/api/sort/index.js";
|
|
|
+import { getStoreInfo } from "@/api/common/index";
|
|
|
+import Amap from "@/components/Map/map.vue";
|
|
|
+import { getDict } from "@/api/common/index.js";
|
|
|
+export default {
|
|
|
+ props: ["data", "saleType", "saleModels"],
|
|
|
+ components: { Amap },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ form: {
|
|
|
+ expressType: 0,
|
|
|
+ unit: "斤",
|
|
|
+ props: [],
|
|
|
+ freeShipping: 0,
|
|
|
+ lookSalesVolume: "",
|
|
|
+ shippingAddrBean: {
|
|
|
+ addr: "",
|
|
|
+ addrDetail: "",
|
|
|
+ cityCode: "",
|
|
|
+ countyCode: "",
|
|
|
+ latitude: "",
|
|
|
+ longitude: "",
|
|
|
+ provinceCode: "",
|
|
|
+ },
|
|
|
+ shippingAddr: "",
|
|
|
+ skuList: [],
|
|
|
+ packing: "",
|
|
|
+ shippingTimeDesc: "",
|
|
|
+ merchantClassifyId: "",
|
|
|
+ merchantClassifyIds: [],
|
|
|
+ merchantClassifyName: "",
|
|
|
+ },
|
|
|
+ addr: "",
|
|
|
+ measure: [],
|
|
|
+ package: [],
|
|
|
+ rules: {
|
|
|
+ freeShipping: [
|
|
|
+ { required: true, message: "请选择运费方式", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ props: [
|
|
|
+ { required: true, message: "商品属性不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ unit: [
|
|
|
+ { required: true, message: "计量单位不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ shippingTimeDesc: [
|
|
|
+ { required: true, message: "发货时间不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ skuList: [{ required: true, message: "规格不能为空", trigger: "blur" }],
|
|
|
+ packing: [
|
|
|
+ { required: true, message: "包装方式不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ "shippingAddrBean.addrDetail": [
|
|
|
+ { required: true, message: "详细地址不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ merchantClassifyIds: [
|
|
|
+ { required: true, message: "店铺所属分类不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+
|
|
|
+ shopInfo: {},
|
|
|
+ saleType: undefined,
|
|
|
+ sj: true,
|
|
|
+ skuIds: [],
|
|
|
+ saleModel: 1,
|
|
|
+ categoryprops: {
|
|
|
+ checkStrictly: true,
|
|
|
+ lazy: true,
|
|
|
+ lazyLoad: this.categoryLazyLoad,
|
|
|
+ label: "label",
|
|
|
+ value: "value",
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ //监听文件url改变时重新赋值
|
|
|
+ saleModels(newVal, oldVal) {
|
|
|
+ this.saleModel = newVal;
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getInfo();
|
|
|
+ this.getdictImpl();
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ categoryLazyLoad(node, resolve) {
|
|
|
+ let level = node.level;
|
|
|
+ if (!node.data) {
|
|
|
+ getMerchantClassifyList({ classifyType: 1, isDefault: 1 }).then(
|
|
|
+ (res) => {
|
|
|
+ //接口
|
|
|
+ const nodes = Array.from(res.data).map((item, index) => ({
|
|
|
+ value: item.id,
|
|
|
+ label: `${item.classifyName}`,
|
|
|
+ leaf: level >= 2,
|
|
|
+ }));
|
|
|
+ // 通过调用resolve将子节点数据返回,通知组件数据加载完成
|
|
|
+ resolve(nodes);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ } else if (level == 1) {
|
|
|
+ getMerchantClassifyList({
|
|
|
+ parentId: node.data.value,
|
|
|
+ classifyType: 1,
|
|
|
+ }).then((res) => {
|
|
|
+ const nodes = Array.from(res.data).map((item) => ({
|
|
|
+ value: item.id,
|
|
|
+ label: `${item.classifyName}`,
|
|
|
+ leaf: level >= 2,
|
|
|
+ // level: 2,
|
|
|
+ }));
|
|
|
+ // 通过调用resolve将子节点数据返回,通知组件数据加载完成
|
|
|
+ resolve(nodes);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ resolve({});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cascaderChange(val) {
|
|
|
+ const dom = document.getElementsByClassName("el-radio is-checked");
|
|
|
+ //这里我把dom打出来看了 最后一个选项才是我选中的节点 即[length-1] 有的博主写的是 第一个元素 即[0] 大家自行尝试
|
|
|
+ let radioDom = dom[dom.length - 1];
|
|
|
+ const brother = radioDom.nextElementSibling;
|
|
|
+ let nodes = this.$refs.formCascader.getCheckedNodes();
|
|
|
+ this.form.merchantClassifyName = nodes[0].label;
|
|
|
+ this.form.merchantClassifyIds = val;
|
|
|
+ this.form.merchantClassifyId = JSON.stringify(val);
|
|
|
+ brother.click();
|
|
|
+ // this.form.merchantClassifyId = `["${this.form.merchantClassifyId.join('')}"]`;
|
|
|
+ this.passValue();
|
|
|
+ },
|
|
|
+ getFormInfo(record) {
|
|
|
+ this.form.merchantClassifyName = record.merchantClassifyName;
|
|
|
+ this.saleModel = record.saleModel;
|
|
|
+ this.addr = record.shippingAddr;
|
|
|
+ this.form.expressType = record.expressType;
|
|
|
+ this.form.shareRate = record.shareRate;
|
|
|
+ this.form.merchantClassifyIds = record.merchantClassifyId;
|
|
|
+ this.form.merchantClassifyId = record.merchantClassifyId;
|
|
|
+ this.form.shippingAddrBean = {
|
|
|
+ addr: record.shippingAddr,
|
|
|
+ addrDetail: record.shippingAddrBean
|
|
|
+ ? record.shippingAddrBean.addrDetail
|
|
|
+ : undefined,
|
|
|
+ cityCode: record.cityCode,
|
|
|
+ countyCode: record.countyCode,
|
|
|
+ latitude: record.latitude,
|
|
|
+ longitude: record.longitude,
|
|
|
+ provinceCode: record.provinceCode,
|
|
|
+ };
|
|
|
+ if (record.props && record.props?.length < 1) {
|
|
|
+ this.form.props = [];
|
|
|
+ } else if (!record.props) {
|
|
|
+ this.form.props = [];
|
|
|
+ } else {
|
|
|
+ this.form.props = record.props;
|
|
|
+ }
|
|
|
+ this.form.lookSalesVolume = record.lookSalesVolume;
|
|
|
+ this.form.unit = record.unit;
|
|
|
+ this.form.shippingAddr = record.shippingAddr;
|
|
|
+ this.form.packing = record.packing;
|
|
|
+ this.form.shippingTimeDesc = record.shippingTimeDesc;
|
|
|
+ if (this.form.freeShipping) {
|
|
|
+ this.form.freeShipping = record.freeShipping;
|
|
|
+ }
|
|
|
+ this.form.skuList = record.skuList;
|
|
|
+ },
|
|
|
+ compilatePrice(data) {
|
|
|
+ if (data.price) {
|
|
|
+ return data.price.toFixed(2);
|
|
|
+ } else if (data.originalPrice) {
|
|
|
+ return data.originalPrice.toFixed(2);
|
|
|
+ } else if (data.originalPrice && data.price) {
|
|
|
+ return data.price.toFixed(2);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ formvalidate() {
|
|
|
+ let that = this;
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ that.$refs.queryForm.validate((valid, row) => {
|
|
|
+ if (valid) {
|
|
|
+ resolve(valid);
|
|
|
+ } else {
|
|
|
+ for (const key in row) {
|
|
|
+ for (let index = 0; index < row[key].length; index++) {
|
|
|
+ this.$message.error(row[key][index].message);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ resolve(valid);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getInfo() {
|
|
|
+ getStoreInfo().then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.shopInfo = res.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getdictImpl() {
|
|
|
+ getDict("stockUnit").then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.measure = res.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ getDict("packType").then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.package = res.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ computePrice(data) {
|
|
|
+ if (
|
|
|
+ data.skuCost.purchaseFee &&
|
|
|
+ data.skuCost.laborFee &&
|
|
|
+ data.skuCost.agencyFee &&
|
|
|
+ data.skuCost.materialFee
|
|
|
+ ) {
|
|
|
+ return (
|
|
|
+ Number(data.skuCost.purchaseFee) +
|
|
|
+ Number(data.skuCost.laborFee) +
|
|
|
+ Number(data.skuCost.agencyFee) +
|
|
|
+ Number(data.skuCost.materialFee)
|
|
|
+ ).toFixed(2);
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ passValue() {
|
|
|
+ this.form.skuList.forEach((e) => {
|
|
|
+ e.skuPriceList.forEach((a) => {
|
|
|
+ a.price = this.computePrice(e);
|
|
|
+ a.originalPrice = this.computePrice(e);
|
|
|
+ a.lowestPrice = this.computePrice(e);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ this.$emit("updateValue", this.form);
|
|
|
+ },
|
|
|
+
|
|
|
+ Mapaddress(data) {
|
|
|
+ this.form.shippingAddr = data.pname + data.cityname + data.adname;
|
|
|
+ this.form.shippingAddrBean.addr = data.address;
|
|
|
+ // this.form.shippingAddrBean.addrDetail = data.name ? data.name : undefined;
|
|
|
+ this.form.shippingAddrBean.cityCode = data.cityCode;
|
|
|
+ this.form.shippingAddrBean.countyCode = data.adcode;
|
|
|
+ if (data.location) {
|
|
|
+ this.form.shippingAddrBean.latitude = data.location.lat;
|
|
|
+ this.form.shippingAddrBean.longitude = data.location.lng;
|
|
|
+ }
|
|
|
+ this.form.shippingAddrBean.provinceCode = data.pcode;
|
|
|
+ this.addr = data.address;
|
|
|
+ this.$refs.mapOpen.closeMap();
|
|
|
+ // this.passValue();
|
|
|
+ },
|
|
|
+ selectAddr() {
|
|
|
+ this.$refs.mapOpen.loadMap();
|
|
|
+ },
|
|
|
+ addattribute() {
|
|
|
+ if (this.form.prop?.length > 0) {
|
|
|
+ this.form.props.push({
|
|
|
+ name: "",
|
|
|
+ id: "",
|
|
|
+ value: "",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.form.prop = [];
|
|
|
+ this.form.props.push({
|
|
|
+ name: "",
|
|
|
+ id: "",
|
|
|
+ value: "",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ removeAttribute(record, index) {
|
|
|
+ this.form.props.splice(index, 1);
|
|
|
+ this.passValue();
|
|
|
+ },
|
|
|
+ removeSpecification(record, index) {
|
|
|
+ console.log("record", record.id);
|
|
|
+ this.skuIds.push(record.id);
|
|
|
+ this.form.skuList.splice(index, 1);
|
|
|
+ this.$emit("skuRemove", this.skuIds);
|
|
|
+ },
|
|
|
+ addSpecification() {
|
|
|
+ if (!this.form.skuList) {
|
|
|
+ this.form.skuList = [];
|
|
|
+ }
|
|
|
+ this.form.skuList.push({
|
|
|
+ stock: undefined,
|
|
|
+ weight: undefined,
|
|
|
+ sj: true,
|
|
|
+ skuCost: {
|
|
|
+ purchaseFee: undefined,
|
|
|
+ laborFee: undefined,
|
|
|
+ agencyFee: undefined,
|
|
|
+ materialFee: undefined,
|
|
|
+ },
|
|
|
+ skuSpecsList: [
|
|
|
+ {
|
|
|
+ specsId: "0",
|
|
|
+ specsName: "",
|
|
|
+ specsValue: "",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ skuPriceList: [
|
|
|
+ {
|
|
|
+ minPurchase: undefined,
|
|
|
+ maxPurchase: undefined,
|
|
|
+ price: undefined,
|
|
|
+ originalPrice: undefined,
|
|
|
+ lowestPrice: 1,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style>
|
|
|
+.el-upload-list__item {
|
|
|
+ transition: none !important;
|
|
|
+ -webkit-transition: nonne !important;
|
|
|
+}
|
|
|
+.el-upload-list__item-name {
|
|
|
+ transition: none !important;
|
|
|
+ -webkit-transition: nonne !important;
|
|
|
+}
|
|
|
+</style>
|
|
|
+<style scoped>
|
|
|
+/deep/ .el-radio-group {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: space-around;
|
|
|
+ height: 50px;
|
|
|
+}
|
|
|
+.item {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ margin-right: 10px;
|
|
|
+}
|
|
|
+.main1 {
|
|
|
+ background: #f1f1f1;
|
|
|
+ min-height: 80px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ align-items: center;
|
|
|
+ padding: 0px 20px;
|
|
|
+}
|
|
|
+.main {
|
|
|
+ width: 58vw;
|
|
|
+ background: #f1f1f1;
|
|
|
+ min-height: 80px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: flex-start;
|
|
|
+ /* display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ align-items: center;
|
|
|
+ padding: 20px 20px 0px 20px; */
|
|
|
+}
|
|
|
+</style>
|