1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246 |
- <template>
- <div v-loading="loading">
- <!-- {{ sitem.is_gold_price }} -->
- <el-form
- :model="addrForm"
- ref="addrForm"
- status-icon
- class="demo-addrForm-goodsOnline"
- :size="'mini'"
- >
- <el-table
- :data="addrForm.good_ladder"
- :size="'mini'"
- border
- stripe
- max-height="300px"
- row-key="key"
- style="width: 100%; margin: 0 0 20px 0"
- >
- <el-table-column type="index" width="50" show-overflow-tooltip />
- <el-table-column
- prop="min_num"
- label="起订量(>=)"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-form-item
- v-show="scope.row.edit"
- :prop="'good_ladder.' + scope.$index + '.' + 'min_num'"
- :rules="addrRules.min_num"
- :size="'mini'"
- :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
- >
- <digital-input
- :values="scope.row.min_num"
- :placeholder="'起订量(>=)'"
- :min="0"
- :max="100000000000"
- :position="'right'"
- :precision="0"
- :controls="false"
- :append="''"
- :newTime="scope.row.newTime"
- :size="'mini'"
- :disabled="!scope.row.edit"
- @reschange="num_change($event, 'min_num', scope.$index)"
- />
- </el-form-item>
- <span v-show="!scope.row.edit">{{ scope.row.min_num }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="new_sale_price" show-overflow-tooltip>
- <template slot="header" slot-scope="scope">
- <span>系统售价</span>
- <!-- <el-popover
- placement="top-start"
- title="计算公式:"
- width="300"
- style="margin: 3px 0 0 0"
- class="fr"
- trigger="hover"
- ><div>
- <div v-if="sitem.is_gold_price === '1'">
- <span class="jiashu">贵金属克重</span>
- <span class="jiahao">*</span>
- <span class="jiashu">实时金价</span>
- <span class="jiahao">+</span>
- <span class="jiashu">工艺费</span>
- <span class="jiahao">*</span>
- <span class="jiashu">贵金属克重</span>
- <span class="jiahao">+</span>
- </div>
- <div>
- <span class="jiashu">包装费</span>
- <span class="jiahao">+</span>
- <span class="jiashu">裸价</span>
- <span class="jiahao">+</span>
- <span class="jiashu">加标费</span>
- <span class="jiahao">+</span>
- <span class="jiashu">证书费</span>
- <span class="jiahao">+</span>
- <span class="jiashu">物流费</span>
- </div>
- </div>
- <i class="el-icon-question tb-icon" slot="reference"></i>
- </el-popover> -->
- </template>
- <template slot-scope="scope">
- <el-form-item
- v-show="scope.row.edit"
- :prop="'good_ladder.' + scope.$index + '.' + 'new_sale_price'"
- :rules="addrRules.new_sale_price"
- :size="'mini'"
- :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
- >
- <el-input
- v-loading="scope.row.loading"
- v-model="scope.row.new_sale_price"
- placeholder="系统售价"
- :disabled="true"
- :size="'mini'"
- maxlength="20"
- />
- </el-form-item>
- <span v-show="!scope.row.edit">{{ scope.row.new_sale_price }}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="sale_price"
- label="售价"
- show-overflow-tooltip
- v-if="!(sitem && sitem.is_gold_price === '1' && is_noble)"
- >
- <template slot-scope="scope">
- <el-form-item
- v-show="scope.row.edit"
- :prop="'good_ladder.' + scope.$index + '.' + 'sale_price'"
- :rules="addrRules.sale_price"
- :size="'mini'"
- :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
- >
- <digital-input
- :values="scope.row.sale_price"
- :placeholder="'售价'"
- :min="0"
- :max="100000000000"
- :position="'right'"
- :precision="2"
- :controls="false"
- :append="''"
- :newTime="scope.row.newTime"
- :size="'mini'"
- :disabled="!scope.row.edit"
- @reschange="num_change($event, 'sale_price', scope.$index)"
- />
- </el-form-item>
- <span v-show="!scope.row.edit">{{ scope.row.sale_price }}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="new_cost_fee"
- show-overflow-
- v-if="sitem && sitem.is_gold_price === '1' && is_noble"
- label="系统工艺费"
- >
- <template slot-scope="scope">
- <el-form-item
- v-show="scope.row.edit"
- :prop="'good_ladder.' + scope.$index + '.' + 'new_cost_fee'"
- :rules="addrRules.new_cost_fee"
- :size="'mini'"
- :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
- >
- <el-input
- v-loading="scope.row.loading"
- v-model="scope.row.new_cost_fee"
- placeholder="工艺费"
- :disabled="true"
- :size="'mini'"
- maxlength="20"
- />
- </el-form-item>
- <span v-show="!scope.row.edit">{{ scope.row.new_cost_fee }}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="cost_fee"
- label="工艺费"
- show-overflow-tooltip
- v-if="sitem && sitem.is_gold_price === '1' && is_noble"
- >
- <template slot-scope="scope">
- <el-form-item
- v-show="scope.row.edit"
- :prop="'good_ladder.' + scope.$index + '.' + 'cost_fee'"
- :rules="addrRules.cost_fee"
- :size="'mini'"
- :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
- >
- <digital-input
- :values="scope.row.cost_fee"
- :placeholder="'工艺费'"
- :min="0"
- :max="100000000000"
- :position="'right'"
- :precision="2"
- :controls="false"
- :append="''"
- :newTime="scope.row.newTime"
- :size="'mini'"
- :disabled="!scope.row.edit"
- @reschange="num_change($event, 'cost_fee', scope.$index)"
- />
- </el-form-item>
- <span v-show="!scope.row.edit">{{ scope.row.cost_fee }}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="market_price"
- label="市场价"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-form-item
- v-show="scope.row.edit"
- :prop="'good_ladder.' + scope.$index + '.' + 'market_price'"
- :rules="addrRules.market_price"
- :size="'mini'"
- :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
- >
- <digital-input
- :values="scope.row.market_price"
- :placeholder="'市场价'"
- :min="0"
- :max="100000000000"
- :position="'right'"
- :precision="2"
- :controls="false"
- :append="''"
- :newTime="scope.row.newTime"
- :size="'mini'"
- :disabled="!scope.row.edit"
- @reschange="num_change($event, 'market_price', scope.$index)"
- />
- </el-form-item>
- <span v-show="!scope.row.edit">{{ scope.row.market_price }}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="market_platform"
- label="对比平台"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-form-item
- v-show="scope.row.edit"
- :prop="'good_ladder.' + scope.$index + '.' + 'market_platform'"
- :rules="addrRules.market_platform"
- :size="'mini'"
- :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
- >
- <el-input
- v-model="scope.row.market_platform"
- placeholder="对比平台"
- maxlength="50"
- :disabled="!scope.row.edit"
- />
- </el-form-item>
- <span v-show="!scope.row.edit">{{
- scope.row.market_platform
- }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="status" label="状态" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-form-item
- v-show="scope.row.edit"
- :prop="'good_ladder.' + scope.$index + '.' + 'status'"
- :rules="addrRules.status"
- :size="'mini'"
- :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
- >
- <el-select v-model="scope.row.status" placeholder="状态">
- <el-option
- v-for="item in status_options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <span v-show="!scope.row.edit">{{
- scope.row.status == "1" ? "启用" : "禁用"
- }}</span>
- </template>
- </el-table-column>
- <el-table-column fixed="right">
- <template slot="header" slot-scope="scope">
- <span>操作</span>
- <el-tooltip effect="dark" content="添加阶梯" placement="top">
- <i
- class="el-icon-circle-plus-outline tb-icon fr"
- @click="openCostEdit(-1)"
- ></i>
- </el-tooltip>
- </template>
- <template slot-scope="scope">
- <el-tooltip
- effect="dark"
- content="保存"
- v-if="scope.row.edit"
- placement="top"
- >
- <i
- class="el-icon-circle-check tb-icon"
- @click="checkRow(scope.$index)"
- ></i>
- </el-tooltip>
- <el-tooltip effect="dark" v-else content="修改" placement="top">
- <i
- class="el-icon-edit tb-icon"
- @click="openCostEdit(scope.$index)"
- ></i>
- </el-tooltip>
- <el-tooltip effect="dark" content="删除" placement="top">
- <i
- class="el-icon-delete tb-icon"
- @click="openCostEditDelete(scope.$index)"
- ></i>
- </el-tooltip>
- </template>
- </el-table-column>
- </el-table>
- </el-form>
- <el-form
- ref="ruleForm"
- :model="ruleForm"
- status-icon
- :rules="rulesThis"
- class="demo-ruleForm-goodsOnline"
- :size="'mini'"
- >
- <el-row>
- <el-col :span="12"
- ><el-form-item label="审核状态" prop="state">
- <el-radio-group
- v-model="ruleForm.state"
- placeholder="请选择审核状态"
- style="width: 100%"
- :size="size || 'medium'"
- @change="stateChange"
- >
- <el-radio
- v-for="item in stateList"
- :key="item.value"
- :label="item.value"
- >{{ item.label }}</el-radio
- >
- </el-radio-group>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item
- label="审核备注"
- v-if="ruleForm.state === '0'"
- prop="remark"
- >
- <el-input
- type="textarea"
- placeholder="审核备注"
- v-model="ruleForm.remark"
- :disabled="disabled"
- maxlength="250"
- show-word-limit
- :autosize="{ minRows: 3, maxRows: 3 }"
- />
- </el-form-item>
- <el-form-item class="fr" v-if="ruleForm.state === '0'" >
- <el-button
- v-if="!isDetail"
- :size="'mini'"
- type="primary"
- @click="rejectRe('')"
- >驳回重新审核
- </el-button>
- </el-form-item>
- <!-- <el-form-item class="fr" v-if="ruleForm.state === '0'" style="margin-right:30px;" >
- <el-button
- v-if="!isDetail"
- :size="'mini'"
- type="danger"
- @click="rejectRe('8')"
- >驳回并下线
- </el-button>
- </el-form-item> -->
- </el-col>
- <el-col :span="24" v-if="ruleForm.state === '1'"
- ><el-form-item label="售价凭证类型" prop="proof_type">
- <el-radio-group
- v-model="ruleForm.proof_type"
- @change="set_proof_url()"
- >
- <el-radio
- v-for="item in options"
- :key="item.value"
- :label="item.value"
- >{{ item.label }}</el-radio
- >
- </el-radio-group>
- <el-button class="fr" type="primary" @click="showVoucher = true"
- >查看历史凭证</el-button
- >
- </el-form-item>
- <show-voucher-model
- :showModel="showVoucher"
- :id="spuCode"
- @cancel="showVoucher = false"
- @searchChange="resvoucher"
- />
- </el-col>
- <el-col :span="18" v-if="ruleForm.state === '1'">
- <el-form-item label="凭证文件" prop="proof_url">
- <ul class="shangchuan-ul">
- <li v-if="ruleForm.proof_type === '1'" class="shiping">
- <div v-if="video_url" class="clearfix">
- <el-popover placement="top" width="300" trigger="hover">
- <video width="275" controls class="fl">
- <source :src="video_url" type="video/mp4" />
- <source :src="video_url" type="video/avi" />
- 您的浏览器不支持Video标签。
- </video>
- <i
- class="el-icon-video-camera-solid hover"
- style="font-size: 18px"
- slot="reference"
- ></i>
- </el-popover>
- <el-link
- :underline="false"
- @click="deleteUrl('1')"
- type="warning"
- style="margin: 0 0 0 16px"
- >删除</el-link
- >
- </div>
- <div class="activity-upload" v-else>
- <div class="btnupload" style="position: relative">
- <i class="el-icon-plus avatar-uploader-icon"></i>
- <video-upload
- class="Upload"
- :disabled="type === 'view' || type === 'editCoin'"
- :accept="'.mp4,.avi'"
- :multiple="false"
- :uploadcondition="beforeVideoUpload"
- @UploadErrorEvent="UploadVideoEventproof_url"
- @UploadSuccessEvent="UploadSuccessVideoproof_url"
- />
- </div>
- <div class="txt-tips fl">
- <p>建议大小:小于10MB</p>
- <p>文件格式:.mp4,.avi</p>
- </div>
- </div>
- </li>
- <li v-if="ruleForm.proof_type === '2'" class="tupian">
- <div v-if="img_url" class="clearfix">
- <img
- style="width: 50px; height: 50px"
- :src="img_url"
- class="avatar fl"
- />
- <el-link
- :underline="false"
- @click="deleteUrl('2')"
- type="warning"
- style="margin: 0 0 0 16px"
- >删除</el-link
- >
- </div>
- <div class="activity-upload" v-else>
- <div class="btnupload" style="position: relative">
- <i class="el-icon-plus avatar-uploader-icon"></i>
- <file-upload
- class="Upload"
- :disabled="type === 'view' || type === 'editCoin'"
- :accept="'.jpg,.png,.jpeg'"
- :multiple="false"
- :uploadcondition="beforeAvatarUpload"
- @UploadErrorEvent="UploadErrorEventproof_url"
- @UploadSuccessEvent="UploadSuccessEventproof_url"
- ></file-upload>
- </div>
- <div class="txt-tips fl">
- <p>建议大小:小于1MB</p>
- <p>文件格式:.jpg,.png,.jpeg</p>
- </div>
- </div>
- </li>
- <li v-if="ruleForm.proof_type === '3'" class="qita">
- <div v-if="other_url" class="clearfix">
- <a :href="other_url" download="凭证文件">点击下载</a>
- <el-link
- :underline="false"
- @click="deleteUrl('3')"
- type="warning"
- style="margin: 0 0 0 16px"
- >删除</el-link
- >
- </div>
- <div class="activity-upload" v-else>
- <div class="btnupload" style="position: relative">
- <i class="el-icon-plus avatar-uploader-icon"></i>
- <file-upload-pdf
- class="Upload"
- :accept="'.xlsx,.xls,.pdf,.zip,.rar,.7z'"
- :multiple="false"
- :uploadcondition="beforeOtherUpload"
- @UploadErrorEvent="UploadErrorOtherproof_url"
- @UploadSuccessEvent="UploadSuccessOtherproof_url"
- />
- </div>
- <div class="txt-tips fl">
- <p>建议大小:小于5MB</p>
- <p>文件格式:.xlsx,.xls,.pdf,.zip,.rar,.7z</p>
- </div>
- </div>
- </li>
- </ul>
- </el-form-item>
- </el-col>
- <el-col :span="6" v-if="ruleForm.state === '1'">
- <el-form-item class="fr">
- <el-button
- v-if="!isDetail"
- :size="'mini'"
- type="primary"
- @click="submitForm"
- >保 存
- </el-button>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </div>
- </template>
- <script>
- // import costFormAddEdit from "./costFormAddEdit";
- import asyncRequest from "@/apis/service/goodStore/goodsOnline";
- import showVoucherModel from "@/components/show-voucher-model";
- export default {
- name: "exam-form",
- props: [
- "size",
- "statusList",
- "disabled",
- "isMust",
- "labelWidth",
- "id",
- "spuCode",
- "sitem",
- ],
- components: {
- // costFormAddEdit,
- showVoucherModel,
- },
- /**
- * 属性集合
- * @param {String} size : 组件大小 非必填
- * @param {Array} statusList : 驳回至备选项 必填
- * @param {Boolean} disabled : 是否禁用 必填
- * @param {Boolean} isMust : 是否需要展示驳回节点 必填
- *
- *
- */
- /**
- * 事件集合
- * @searchChange : 选中值变化调用 抛出选中数据
- */
- data() {
- const validate_num = (rule, value, callback) => {
- const { required } = rule;
- if (required && value === "") {
- callback(new Error("不能为空!"));
- } else {
- callback();
- }
- };
- const validate_num_0 = (rule, value, callback) => {
- const { required } = rule;
- if (required && value === "") {
- callback(new Error("不能为空!"));
- } else if (
- required &&
- (value === "0" ||
- value === "0." ||
- value === "0.0" ||
- value === "0.00" ||
- value === "0.000")
- ) {
- callback(new Error("不能为零!"));
- } else {
- callback();
- }
- };
- return {
- loading: false,
- stateList: [
- {
- value: "1",
- label: "通过",
- },
- {
- value: "0",
- label: "驳回",
- },
- ],
- showVoucher: false,
- is_noble: false,
- video_url: "",
- img_url: "",
- other_url: "",
- options: [
- {
- value: "1",
- label: "视频",
- },
- {
- value: "2",
- label: "图片",
- },
- {
- value: "3",
- label: "其他",
- },
- ],
- status_options: [
- {
- value: "1",
- label: "启用",
- },
- {
- value: "0",
- label: "禁用",
- },
- ],
- showModelThis: this.showModel,
- pickerOptions: {
- disabledDate(time) {
- return time.getTime() < Date.now() - 60 * 60 * 24 * 1000;
- },
- },
- costshowModel: false,
- costmodelIndex: "",
- costsitem: {},
- ruleForm: {
- skuCode: "",
- numStatus:"",
- state:"1",//通过or驳回
- proof_type: "1", //
- proof_url: "", //驳回至
- remark:"",
- },
- rulesThis: this.rules,
- rules: {
- proof_type: [
- {
- required: true,
- message: "请选择凭证类型",
- trigger: "change",
- },
- ],
- proof_url: [
- {
- required: true,
- message: "请上传凭证文件",
- trigger: "blur,change",
- },
- ],
- rebut: [
- {
- required: true,
- message: "请选择驳回节点",
- trigger: "change",
- },
- ],
- state: [
- {
- required: true,
- message: "请选择审核状态",
- trigger: "change",
- },
- ],
- remark: [
- { required: true, message: "请输入审核备注", trigger: "blur" },
- {
- min: 1,
- max: 250,
- message: "长度在 1 到 250 个字符",
- trigger: "blur",
- },
- ],
- },
- addrForm: {
- good_ladder: [],
- },
- addrRules: {
- min_num: [
- {
- required: true,
- validator: validate_num_0,
- trigger: "blur",
- },
- ],
- new_sale_price: [{ required: false }],
- sale_price: [
- {
- required: true,
- trigger: "blur",
- validator: validate_num,
- },
- ],
- cost_fee: [
- {
- required: true,
- trigger: "blur",
- validator: validate_num,
- },
- ],
- new_cost_fee: [
- {
- required: false,
- },
- ],
- market_price: [
- {
- required: true,
- validator: validate_num,
- trigger: "blur",
- },
- ],
- market_platform: [
- {
- required: true,
- message: "对比平台不能为空",
- trigger: "blur",
- },
- ],
- status: [
- {
- required: true,
- message: "状态不能为空",
- trigger: "change",
- },
- ],
- },
- };
- },
- watch: {
- isDetail: function (val, old) {
- if (this.isDetail !== val) {
- this.options = [];
- this.selectLoading = false;
- }
- },
- newTime: function (val) {
- if (val) {
- this.initForm();
- }
- },
- },
- mounted() {
- this.initForm();
- },
- methods: {
- // 点击驳回重新审核或驳回并下线按钮
- async rejectRe(numStatus) {
- this.ruleForm.numStatus = numStatus
- await this.$refs.ruleForm.validate(async (valid) => {
- if (valid) {
- console.log(valid)
- this.$emit("searchChange", this.ruleForm);
- } else {
- console.log("error submit!!");
- return false;
- }
- });
- },
- async initForm() {
- console.log(this.spuCode);
- this.loading = true;
- await this.resetForm();
- this.rulesThis = this.rules;
- this.stateChange()
- this.loading = false;
- },
- stateChange() {
- if (this.ruleForm.state === "1") {
- this.rulesThis.rebut[0].required = false;
- this.rulesThis.remark[0].required = false;
- } else {
- this.rulesThis.rebut[0].required = true;
- this.rulesThis.remark[0].required = true;
- }
- },
- openCostEdit(index) {
- let findex = this.addrForm.good_ladder.findIndex((v) => v.edit === true);
- if (findex !== -1) {
- this.$message.warning("当前已有阶梯售价在编辑,请保存后再试!");
- return;
- } else {
- if (index === -1) {
- this.addrForm.good_ladder.push({
- edit: true,
- min_num: "0",
- new_sale_price: "0",
- new_cost_fee: "0",
- sale_price: "0",
- cost_fee: "0",
- market_price: "0",
- market_platform: "",
- status: "1",
- });
- } else {
- this.addrForm.good_ladder[index].edit = true;
- this.addrForm.good_ladder[index].newTime = new Date().valueOf() + "";
- }
- }
- },
- async get_new(index) {
- const { min_num } = this.addrForm.good_ladder[index];
- this.addrForm.good_ladder[index].search_loading = true;
- let { code, data, message } = await asyncRequest.goodupprice({
- min_num: min_num,
- spuCode: this.spuCode,
- });
- let resModel = {
- isok: code,
- price: code === 0 ? data.sale_price : "0",
- new_cost_fee: code === 0 ? data.new_cost_fee : "0",
- message: message,
- };
- this.addrForm.good_ladder[index].search_loading = false;
- return resModel;
- },
- //保存某一行
- async checkRow(rowIndex) {
- await this.$refs.addrForm.validate(async (valid) => {
- if (valid) {
- if (!this.addrForm.good_ladder[rowIndex].search_loading) {
- const { min_num } = this.addrForm.good_ladder[rowIndex];
- let findex = this.addrForm.good_ladder.findIndex(
- (v) => v.edit !== true && v.min_num + "" === min_num + ""
- );
- if (findex !== -1) {
- this.$message.warning("当前已有相同起订量的销售价!");
- return;
- }
- let { isok, price, message, new_cost_fee } = await this.get_new(
- rowIndex
- );
- if (isok === 0) {
- this.addrForm.good_ladder[rowIndex].new_sale_price = price;
- this.addrForm.good_ladder[rowIndex].new_cost_fee = new_cost_fee;
- this.addrForm.good_ladder[rowIndex].edit = false;
- } else if (isok >= 100 && isok <= 104) {
- await this.logout();
- } else {
- this.addrForm.good_ladder[rowIndex].new_sale_price = price;
- this.addrForm.good_ladder[rowIndex].new_cost_fee = new_cost_fee;
- this.$message.warning(message);
- }
- }
- } else {
- console.log("error submit!!");
- return false;
- }
- });
- },
- openCostEditDelete(index) {
- this.addrForm.good_ladder.splice(index, 1);
- },
- async num_change(e, key, index) {
- this.addrForm.good_ladder[index][key] = e + "" || "0";
- if (key === "min_num") {
- const { min_num } = this.addrForm.good_ladder[index];
- if (min_num === "" || min_num === "0") {
- this.addrForm.good_ladder[index].new_sale_price = "0";
- } else {
- if (!this.addrForm.good_ladder[index].search_loading) {
- let { isok, price, message, new_cost_fee } = await this.get_new(
- index
- );
- if (isok === 0) {
- this.addrForm.good_ladder[index].new_sale_price = price;
- this.addrForm.good_ladder[index].new_cost_fee = new_cost_fee;
- } else if (isok >= 100 && isok <= 104) {
- await this.logout();
- } else {
- this.addrForm.good_ladder[index].new_sale_price = price;
- this.addrForm.good_ladder[index].new_cost_fee = new_cost_fee;
- this.$message.warning(message);
- }
- }
- }
- }
- },
- async resetForm() {
- this.is_noble = false;
- // 重置
- await this.$nextTick(async () => {
- if (this.$refs.ruleForm && this.$refs.addrForm) {
- this.$refs.ruleForm.resetFields();
- this.$refs.ruleForm.clearValidate();
- this.$refs.addrForm.resetFields();
- this.$refs.addrForm.clearValidate();
- let { proof, ladderlist, cat_info } = this.sitem;
- if (cat_info && cat_info.length > 0) {
- cat_info.forEach((e) => {
- if (e.id === "6") {
- this.is_noble = true;
- }
- });
- }
- ladderlist.map((a) => {
- a.search_loading = false;
- a.new_sale_price = "0";
- a.newTime = new Date().valueOf() + "";
- a.edit = false;
- return a;
- });
- this.ruleForm = {
- skuCode: this.id,
- state: "1", // 通过or驳回
- remark:"",
- numStatus:"",
- proof_type: proof && proof.proof_type ? proof.proof_type : "1", // 通过or驳回
- proof_url: proof && proof.proof_url ? proof.proof_url : "", //驳回至
- };
- this.addrForm = {
- good_ladder:
- ladderlist && ladderlist.length > 0
- ? JSON.parse(JSON.stringify(ladderlist))
- : [],
- };
- // console.log(this.ruleForm.proof_url);
- switch (this.ruleForm.proof_type) {
- case "1":
- this.video_url = this.ruleForm.proof_url;
- break;
- case "2":
- this.img_url = this.ruleForm.proof_url;
- break;
- case "3":
- this.other_url = this.ruleForm.proof_url;
- break;
- default:
- this.video_url = this.ruleForm.proof_url;
- }
- this.$refs.ruleForm.validateField("proof_url");
- for (let i = 0; i < this.addrForm.good_ladder.length; i++) {
- let { isok, price, new_cost_fee, message } = await this.get_new(i);
- if (isok === 0) {
- this.addrForm.good_ladder[i].new_sale_price = price;
- this.addrForm.good_ladder[i].new_cost_fee = new_cost_fee;
- this.addrForm.good_ladder[i].edit = false;
- } else if (isok >= 100 && isok <= 104) {
- await this.logout();
- } else {
- this.addrForm.good_ladder[i].new_sale_price = price;
- this.addrForm.good_ladder[i].new_cost_fee = new_cost_fee;
- this.addrForm.good_ladder[i].edit = true;
- this.addrForm.good_ladder[i].newTime = new Date().valueOf() + "";
- this.$message.warning(message);
- }
- }
- }
- });
- },
- async submitForm() {
- await this.$refs.ruleForm.validate(async (valid) => {
- if (valid) {
- this.loading = true;
- let model = JSON.parse(JSON.stringify(this.ruleForm));
- if (this.addrForm.good_ladder.length === 0) {
- this.$message.warning("至少添加一条销售价信息!");
- this.loading = false;
- return;
- }
- let list = JSON.parse(JSON.stringify(this.addrForm.good_ladder));
- let isedit = false;
- list.forEach((v) => {
- if (v.edit) {
- isedit = true;
- }
- });
- if (isedit) {
- this.$message.warning("请保存阶梯售价!");
- this.loading = false;
- return;
- }
- let all_is_ok = true;
- for (let i = 0; i < this.addrForm.good_ladder; i++) {
- this.addrForm.good_ladder[i].search_loading = true;
- let { isok, price, new_cost_fee } = await this.get_new(i);
- if (isok === 0) {
- this.addrForm.good_ladder[i].new_sale_price = price;
- this.addrForm.good_ladder[i].new_cost_fee = new_cost_fee;
- this.addrForm.good_ladder[i].this.addrForm.good_ladder[
- i
- ].edit = false;
- } else if (isok >= 100 && isok <= 104) {
- await this.logout();
- } else {
- all_is_ok = false;
- this.addrForm.good_ladder[i].new_sale_price = price;
- this.addrForm.good_ladder[i].new_cost_fee = new_cost_fee;
- this.addrForm.good_ladder[i].edit = true;
- this.addrForm.good_ladder[i].newTime = new Date().valueOf() + "";
- }
- }
- if (!all_is_ok) {
- this.$message.warning("阶梯售价未满足成本最低起订量!");
- this.loading = false;
- }
- let list2 = [];
- list.forEach((e) => {
- let n = JSON.parse(JSON.stringify(e));
- for (let key in n) {
- n[key] += "";
- }
- delete n["index"];
- list2.push(n);
- });
- model.good_ladder = list2;
- model.skuCode = this.id;
- let res = await asyncRequest.ladderOne(model);
- this.loading = false;
- if (res && res.code === 0) {
- this.$notify.success({
- title: "信息提交成功",
- message: "",
- });
- this.$emit("resSuccess", true);
- } else if (res && res.code >= 100 && res.code <= 104) {
- await this.logout();
- } else {
- this.$message.warning(res.message);
- }
- } else {
- console.log("error submit!!");
- return false;
- }
- });
- },
- resvoucher(e) {
- const { proof_type, proof_url } = e;
- this.ruleForm.proof_type = proof_type || "1";
- switch (this.ruleForm.proof_type) {
- case "1":
- this.video_url = proof_url;
- break;
- case "2":
- this.img_url = proof_url;
- break;
- case "3":
- this.other_url = proof_url;
- break;
- default:
- this.video_url = proof_url;
- }
- this.set_proof_url();
- },
- //图片上传成功
- async UploadSuccessEventproof_url(data) {
- const { url } = data;
- if (url === "noToken") {
- await this.logout();
- } else {
- this.img_url = url;
- this.set_proof_url();
- this.$message.success("图片上传成功!");
- }
- },
- //图片上传失败
- UploadErrorEventproof_url(res) {
- if (res !== "break") {
- this.set_proof_url();
- this.$message.error("图片上传失败!");
- }
- },
- //判断图片规格
- beforeAvatarUpload(file) {
- let isJPG = false;
- if (
- file.type === "image/jpg" ||
- file.type === "image/png" ||
- file.type === "image/jpeg"
- ) {
- isJPG = true;
- }
- const isLt2M = file.size / 1024 / 1024 < 1;
- if (!isJPG) {
- this.$message.error("图片格式不正确!");
- }
- if (!isLt2M) {
- this.$message.error("图片大小不能超过 1MB!");
- }
- return isJPG && isLt2M;
- },
- //视频上传成功
- async UploadSuccessVideoproof_url(data) {
- const { url } = data;
- if (url === "noToken") {
- await this.logout();
- } else {
- this.video_url = url;
- this.set_proof_url();
- this.$message.success("视频上传成功!");
- }
- },
- //视频上传失败
- UploadErrorVideoproof_url(res) {
- if (res !== "break") {
- this.set_proof_url();
- this.$message.error("视频上传失败!");
- }
- },
- //判断视频规格
- beforeVideoUpload(file) {
- let isJPG = false;
- if (file.type === "video/mp4" || file.type === "video/avi") {
- isJPG = true;
- }
- const isLt2M = file.size / 1024 / 1024 < 10;
- if (!isJPG) {
- this.$message.error("视频格式不正确!");
- }
- if (!isLt2M) {
- this.$message.error("视频大小不能超过 10MB!");
- }
- return isJPG && isLt2M;
- },
- // 其他文件上传成功
- async UploadSuccessOtherproof_url(data) {
- const { url } = data;
- if (url === "noToken") {
- await this.logout();
- } else {
- this.other_url = url;
- this.set_proof_url();
- this.$message.success("文件成功!");
- }
- },
- //其他文件上传失败
- UploadErrorOtherproof_url(res) {
- if (res !== "break") {
- this.set_proof_url();
- this.$message.error("文件上传失败!");
- }
- },
- //判断其他文件规格
- beforeOtherUpload(file) {
- console.log(file);
- let isJPG = false;
- if (
- file.type === "application/vnd.ms-excel" ||
- file.type ===
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
- file.type === "application/pdf" ||
- file.type === "application/x-zip-compressed"
- ) {
- isJPG = true;
- }
- let name = file.name;
- let list = name.split(".");
- if (list[list.length - 1] === "rar" || list[list.length - 1] === "7z") {
- isJPG = true;
- }
- const isLt2M = file.size / 1024 / 1024 < 5;
- if (!isJPG) {
- this.$message.error("文件格式不正确!");
- }
- if (!isLt2M) {
- this.$message.error("文件大小不能超过 5MB!");
- }
- return isJPG && isLt2M;
- },
- deleteUrl(type) {
- switch (type) {
- case "1":
- this.video_url = "";
- break;
- case "2":
- this.img_url = "";
- break;
- case "3":
- this.other_url = "";
- break;
- default:
- this.video_url = "";
- }
- this.set_proof_url();
- },
- set_proof_url() {
- const { proof_type } = this.ruleForm;
- switch (proof_type) {
- case "1":
- this.ruleForm.proof_url = this.video_url;
- break;
- case "2":
- this.ruleForm.proof_url = this.img_url;
- break;
- case "3":
- this.ruleForm.proof_url = this.other_url;
- break;
- default:
- this.ruleForm.proof_url = this.video_url;
- }
- this.$refs.ruleForm.validateField("proof_url");
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .demo-ruleForm-goodsOnline {
- .shangchuan-ul {
- li {
- position: relative;
- width: 100%;
- &.tupian {
- }
- }
- }
- }
- </style>
|