09618ed2de2ad98ef87e68206eebdcb6.json 12 KB

1
  1. {"remainingRequest":"D:\\front\\item\\zyAdmin\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\front\\item\\zyAdmin\\src\\pages\\product\\components\\vipPriceSet.vue?vue&type=style&index=0&id=44f2ee41&scoped=true&lang=css","dependencies":[{"path":"D:\\front\\item\\zyAdmin\\src\\pages\\product\\components\\vipPriceSet.vue","mtime":1761614939046},{"path":"D:\\front\\item\\zyAdmin\\node_modules\\css-loader\\index.js","mtime":1761614929364},{"path":"D:\\front\\item\\zyAdmin\\node_modules\\vue-loader\\lib\\loaders\\stylePostLoader.js","mtime":1761614937403},{"path":"D:\\front\\item\\zyAdmin\\node_modules\\postcss-loader\\src\\index.js","mtime":1761614935133},{"path":"D:\\front\\item\\zyAdmin\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1761614927801},{"path":"D:\\front\\item\\zyAdmin\\node_modules\\vue-loader\\lib\\index.js","mtime":1761614937402}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:DQouaWNvbmJpYW5qaTEgew0KICBmb250LXNpemU6IDEycHg7DQogIHBhZGRpbmctbGVmdDogNHB4Ow0KICBjdXJzb3I6IHBvaW50ZXI7DQp9DQoNCi5wb3BvdmVyLWlucHV0IHsNCiAgd2lkdGg6IDEwMHB4Ow0KfQ0KDQoudy0yNTAgew0KICB3aWR0aDogMjUwcHg7DQp9DQoNCi5wb3AtdGl0bGUgew0KICBmb250LXNpemU6IDE0cHg7DQogIGZvbnQtd2VpZ2h0OiBib2xkOw0KICBtYXJnaW4tYm90dG9tOiAxNHB4Ow0KfQ0KDQoucmVkIHsNCiAgY29sb3I6ICNlOTMzMjM7DQp9DQoNCi5oLTIzIHsNCiAgaGVpZ2h0OiAyM3B4Ow0KfQ0K"},{"version":3,"sources":["vipPriceSet.vue"],"names":[],"mappings":";AA+QA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA","file":"vipPriceSet.vue","sourceRoot":"src/pages/product/components","sourcesContent":["<template>\r\n <div>\r\n <el-dialog :visible.sync=\"visible\" title=\"自定义会员价\" width=\"900\"\r\n ><el-form :model=\"formData\" label-width=\"120px\">\r\n <el-form-item label=\"付费会员专属:\">\r\n <el-switch\r\n v-model=\"formData.vip_product\"\r\n :active-value=\"1\"\r\n :inactive-value=\"0\"\r\n active-text=\"开启\"\r\n inactive-text=\"关闭\"\r\n size=\"large\"\r\n class=\"defineSwitch\"\r\n >\r\n </el-switch>\r\n </el-form-item>\r\n <el-form-item label=\"付费会员价:\">\r\n <el-switch\r\n v-model=\"formData.is_vip\"\r\n :active-value=\"1\"\r\n :inactive-value=\"0\"\r\n active-text=\"开启\"\r\n inactive-text=\"关闭\"\r\n size=\"large\"\r\n class=\"defineSwitch\"\r\n @change=\"changeVip\"\r\n >\r\n </el-switch>\r\n </el-form-item>\r\n <el-form-item label-width=\"0px\">\r\n <el-table size=\"small\" border max-height=\"460\" :data=\"attrData\" style=\"width: 100%\">\r\n <el-table-column prop=\"pic\" label=\"规格图\" min-width=\"90\" align=\"center\">\r\n <template slot-scope=\"scope\">\r\n <div class=\"tabBox_img m-auto\" v-viewer>\r\n <img v-lazy=\"scope.row.pic\" />\r\n </div>\r\n </template>\r\n </el-table-column>\r\n <el-table-column prop=\"suk\" label=\"产品规格\" min-width=\"120\" align=\"center\"></el-table-column>\r\n <el-table-column prop=\"price\" label=\"售价\" min-width=\"120\" align=\"center\"></el-table-column>\r\n <el-table-column min-width=\"140\" align=\"center\" v-if=\"formData.is_vip == 1\">\r\n <template slot=\"header\" slot-scope=\"scope\">\r\n <span>付费会员价</span>\r\n <el-popover\r\n ref=\"vipSetPopover\"\r\n :value.sync=\"vipSetPopoverPopver\"\r\n placement=\"top\"\r\n width=\"290\"\r\n trigger=\"click\"\r\n >\r\n <div class=\"pop-title\">批量修改本列</div>\r\n <div class=\"mt-14\">\r\n <el-radio-group v-model=\"vipSetType\">\r\n <el-radio :label=\"0\">指定价格</el-radio>\r\n <el-radio :label=\"1\">折扣</el-radio>\r\n <el-radio :label=\"2\">减现</el-radio>\r\n </el-radio-group>\r\n </div>\r\n <div class=\"mt10 mb10 acea-row row-middle\">\r\n <span class=\"mr5\" v-show=\"vipSetType == 2\">减</span>\r\n <el-input type=\"number\" class=\"popover-input\" v-model=\"vipSetNum\">\r\n <template slot=\"suffix\">\r\n <span v-show=\"vipSetType == 0\">元</span>\r\n <span v-show=\"vipSetType == 1\">%</span>\r\n </template>\r\n </el-input>\r\n <div class=\"acea-row row-right row-middle ml14\">\r\n <el-button size=\"small\" @click=\"closeVipSet\">取消</el-button>\r\n <el-button size=\"small\" type=\"primary\" class=\"ml-14\" @click=\"vipSetConfirm\">确认</el-button>\r\n </div>\r\n </div>\r\n <span class=\"iconfont iconbianji1\" slot=\"reference\" @click.stop=\"vipSetPopoverPopver = true\"></span>\r\n </el-popover>\r\n </template>\r\n <template slot-scope=\"scope\">\r\n <el-input type=\"number\" v-model=\"scope.row.vip_price\" @change=\"vipRowReplace(scope.row)\">\r\n <template slot=\"suffix\">\r\n <span>元</span>\r\n </template>\r\n </el-input>\r\n <div class=\"flex-x-center red\" v-show=\"scope.row.vip_price == 0\">会员价不可为0</div>\r\n <div class=\"flex-x-center red\" v-show=\"Number(scope.row.vip_price) > Number(scope.row.price)\">\r\n 会员价不可大于售价\r\n </div>\r\n </template>\r\n </el-table-column>\r\n </el-table>\r\n </el-form-item>\r\n </el-form>\r\n <div slot=\"footer\" class=\"dialog-footer\">\r\n <el-button @click=\"onCancel\">取消</el-button>\r\n <el-button type=\"primary\" @click=\"submitForm\" :disabled=\"disabled\" class=\"ml-14\">确认</el-button>\r\n </div>\r\n </el-dialog>\r\n </div>\r\n</template>\r\n<script>\r\nimport { productBrokerage, productBrokerageUpdate } from '@/api/product';\r\nexport default {\r\n name: 'vipPriceSet',\r\n data() {\r\n return {\r\n formData: {\r\n is_vip: 0,\r\n vip_product: 1,\r\n },\r\n brokerage: '',\r\n brokerage_two: '',\r\n loading: false,\r\n attrData: [],\r\n disabled: false,\r\n levelList: [],\r\n vipSetType: 0,\r\n vipSetNum: '',\r\n levelSetType: 0,\r\n levelSetNum: '',\r\n visible: false,\r\n vipSetPopoverPopver: false,\r\n popoverTwo: false,\r\n };\r\n },\r\n props: {\r\n productId: {\r\n type: Number,\r\n default: 0,\r\n },\r\n },\r\n watch: {\r\n visible(val) {\r\n if (val) {\r\n this.getData();\r\n }\r\n },\r\n },\r\n created() {},\r\n methods: {\r\n vipPriceReplace(value) {\r\n this.vipSetNum = value;\r\n },\r\n levelPriceReplace(value) {\r\n this.levelSetNum = value;\r\n },\r\n submitForm() {\r\n let isSuccess = true,\r\n step = true;\r\n if (this.formData.is_vip) {\r\n this.attrData.forEach((item) => {\r\n if (item.vip_price == 0 && this.formData.is_vip) {\r\n isSuccess = false;\r\n }\r\n if (Number(item.vip_price) > Number(item.price) && this.formData.is_vip) {\r\n step = false;\r\n }\r\n });\r\n }\r\n if (!isSuccess) return this.$message.error('会员价不可为0');\r\n if (!step) return this.$message.error('会员价不可大于售价');\r\n this.disabled = true;\r\n let data = {\r\n ...this.formData,\r\n attr_value: this.attrData,\r\n };\r\n productBrokerageUpdate(this.productId, 2, data)\r\n .then((res) => {\r\n this.$message.success(res.msg);\r\n this.disabled = false;\r\n this.visible = false;\r\n })\r\n .catch((err) => {\r\n this.$message.error(err.msg);\r\n this.disabled = false;\r\n });\r\n },\r\n closeVipSet(i) {\r\n console.log(this.$refs['vipSetPopover'].doClose);\r\n this.vipSetPopoverPopver = false;\r\n this.$refs.vipSetPopover.doClose();\r\n this.vipSetType = 0;\r\n this.vipSetNum = '';\r\n },\r\n closeLevelSet(i) {\r\n this.popoverTwo = false;\r\n // this.$refs['popoverRef_' + i].doClose(); //关闭的\r\n this.levelSetType = 0;\r\n this.levelSetNum = '';\r\n },\r\n vipSetConfirm() {\r\n if (this.vipSetNum == 0) return this.$message.error('会员价不可为0');\r\n if (this.vipSetType == 1 && this.vipSetNum > 100) return this.$message.error('折扣不可超过100');\r\n this.attrData.map((item) => {\r\n if (this.vipSetType == 0) {\r\n item.vip_price = this.vipSetNum;\r\n } else if (this.vipSetType == 1) {\r\n item.vip_price = ((this.vipSetNum / 100) * item.price).toFixed(2);\r\n } else {\r\n item.vip_price = item.price - this.vipSetNum;\r\n }\r\n });\r\n this.closeVipSet();\r\n },\r\n levelSetConfirm(index) {\r\n if (this.levelSetNum == 0) return this.$message.error('等级会员价不可为0');\r\n if (this.levelSetType == 1 && this.levelSetNum > 100) return this.$message.error('折扣不可超过100');\r\n this.attrData.map((item) => {\r\n if (this.levelSetType == 0) {\r\n item.level_price[index].price = this.levelSetNum;\r\n } else if (this.levelSetType == 1) {\r\n item.level_price[index].price = ((this.levelSetNum / 100) * item.price).toFixed(2);\r\n } else {\r\n item.level_price[index].price = item.price - this.levelSetNum;\r\n }\r\n });\r\n this.closeLevelSet(index);\r\n },\r\n onCancel() {\r\n this.visible = false;\r\n },\r\n changeLevelType(type) {\r\n this.attrData.map((item) => {\r\n this.$set(\r\n item,\r\n 'level_price',\r\n this.levelList.map((val) => {\r\n return {\r\n id: val.id,\r\n price: type == 1 ? val.discount * 100 : 0,\r\n };\r\n }),\r\n );\r\n });\r\n },\r\n vipRowReplace(row) {\r\n // row.vip_price = row.vip_price.replace(/^-|\\D/g, '');\r\n },\r\n levelRowReplace(row, i) {\r\n row.level_price[i].price = row.level_price[i].price.replace(/^-|\\D/g, '');\r\n },\r\n getData() {\r\n //获取产品属性\r\n productBrokerage(this.productId, 2).then((res) => {\r\n this.formData.is_vip = res.data.storeInfo.is_vip;\r\n this.formData.vip_product = res.data.storeInfo.vip_product;\r\n this.attrData = Object.values(res.data.attrValue);\r\n // this.levelList = res.data.level_list;\r\n // if (res.data.level_list.length) {\r\n // this.attrData.map((item) => {\r\n // if (!item.level_price.length) {\r\n // this.$set(\r\n // item,\r\n // 'level_price',\r\n // res.data.level_list.map((val) => {\r\n // return {\r\n // id: val.id,\r\n // price: res.data.storeInfo.is_vip == 1 ? val.discount * 100 : 0,\r\n // };\r\n // }),\r\n // );\r\n // }\r\n // });\r\n // }\r\n });\r\n },\r\n changeVip(is_vip) {\r\n this.attrData.map((item) => {\r\n this.$set(item, 'vip_price', is_vip == 1 ? item.price : 0);\r\n });\r\n },\r\n },\r\n};\r\n</script>\r\n<style scoped>\r\n.iconbianji1 {\r\n font-size: 12px;\r\n padding-left: 4px;\r\n cursor: pointer;\r\n}\r\n\r\n.popover-input {\r\n width: 100px;\r\n}\r\n\r\n.w-250 {\r\n width: 250px;\r\n}\r\n\r\n.pop-title {\r\n font-size: 14px;\r\n font-weight: bold;\r\n margin-bottom: 14px;\r\n}\r\n\r\n.red {\r\n color: #e93323;\r\n}\r\n\r\n.h-23 {\r\n height: 23px;\r\n}\r\n</style>\r\n"]}]}