| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375 |
- <?php
- use common\helpers\ComponentHelper;
- ComponentHelper::loadComponentView('com-rich-text');
- ComponentHelper::loadComponentView('com-dialog-select');
- ComponentHelper::loadComponentView('com-qq-map');
- ComponentHelper::loadComponentView('com-dialog-screen-select');
- ?>
- <div id="app" v-cloak>
- <el-card v-loading="loading" style="border:0" shadow="never" body-style="background-color: #f3f3f3;padding: 0 0;">
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <el-tab-pane label="基础信息" name="basic_setting">
- <?php ComponentHelper::loadComponentView('detail-basic', __DIR__ . '/');
- ?>
- </el-tab-pane>
- <el-tab-pane label="小店设置" name="store_setting" class="cashier-tabs">
- <?php ComponentHelper::loadComponentView('detail-store', __DIR__ . '/'); ?>
- </el-tab-pane>
- <!-- <el-tab-pane label="商品管理" name="goods_list">-->
- <!-- --><?php //ComponentHelper::loadComponentView('detail-goods', __DIR__ . '/'); ?>
- <!-- </el-tab-pane>-->
- </el-tabs>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- var validatePass = (rule, value, callback) => {
- if (value === '' && this.storeForm.password !== '') {
- callback(new Error('两次输入密码不一致'));
- } else if (value !== this.storeForm.password) {
- callback(new Error('两次输入密码不一致!'));
- } else {
- callback();
- }
- };
- var validateTime = (rule, value, callback) => {
- if ((!this.times || !this.times.length) && this.storeForm.shop_status == 1) {
- callback(new Error('请设置营业时间'));
- } else {
- callback();
- }
- };
- var validateStoreServiceRatio = (rule, value, callback) => {
- if (this.storeForm.store_service_fee == 1 && value <= 0) {
- callback(new Error('请填写服务费收取比例'));
- } else {
- callback();
- }
- };
- var validateCachierServiceRatio = (rule, value, callback) => {
- if (value < 0) {
- callback(new Error('服务费不能小于0'));
- }
- if (value > 100) {
- callback(new Error('服务费不能大于100'));
- }
- callback();
- };
- return {
- store_id: 0,
- loading: false,
- switchStoreLoading: false,
- submitLoading: false,
- activeName: 'basic_setting',
- activeName2: 'all',
- times: null,
- system_setting: [],
- alone_setting: {
- is_alone: 1,
- distribution_scope: '',
- delivery_fee: 0,
- initial_delivery_amount: 0,
- distance: 0,
- distance_charge: 0,
- every_distance: 0,
- every_distance_charge: 0,
- },
- basicForm: {
- goods_auth: 0,
- service_fee: 0,
- settle_type: 0,
- platform_ratio: 0,
- risk_management: 0,
- risk_management_ratio: 0,
- settle_scene: 1,
- store_distribution_status: 0,
- store_agent_status: 0,
- store_area_status: 0,
- store_boss_status: 0,
- payment_settlement_type: 0,
- address: '',
- province_id: '',
- city_id: '',
- district_id: '',
- street_id: '',
- community_id: ''
- },
- storeForm: {
- username: '',
- password: '',
- repassword: '',
- shop_status: 1,
- business_time_start: '',
- business_time_end: '',
- merchant_distribution: 1,
- self_mention: 1,
- intra_city_distribution: {
- is_alone: 0,
- distribution_scope: '',
- delivery_fee: 0,
- initial_delivery_amount: 0,
- distance: 0,
- distance_charge: 0,
- every_distance: 0,
- every_distance_charge: 0,
- },
- },
- basicFormRules: {},
- storeRules: {
- shop_status: [{
- required: true,
- message: '请设置营业状态',
- trigger: 'blur'
- }],
- range_time: [{
- required: true,
- validator: validateTime,
- trigger: 'blur'
- }],
- store_service_fee: [{
- required: true,
- message: '请设置是否收取服务器',
- trigger: 'blur'
- }],
- store_service_ratio: [{
- validator: validateStoreServiceRatio,
- trigger: 'blur'
- }],
- store_settle_type: [{
- required: true,
- message: '请选择计算方式',
- trigger: 'blur'
- }],
- store_settle_scene: [{
- required: true,
- message: '请选择结算方式',
- trigger: 'blur'
- }],
- repassword: [{
- validator: validatePass,
- trigger: 'blur'
- }],
- balance_cash_service_fee: [{
- required: true,
- message: '请输入提现手续费',
- trigger: 'blur'
- }],
- balance_cash_service_fee_month: [{
- required: true,
- message: '请输入当月商家累计提现',
- trigger: 'blur'
- }],
- balance_cash_service_fee_diff: [{
- required: true,
- message: '请输入超出手续费',
- trigger: 'blur'
- }],
- huifu_mch_no: [{
- required: true,
- message: '请输入汇付分账商户号',
- trigger: 'blur'
- }],
- },
- basicRules: {},
- statisticsData: { // 基础信息数据统计对象
- 'total_money': '累计收入',
- 'balance': '当前余额',
- 'unsettled_amount': '累计提现',
- 'user_nums': '小店用户数',
- 'good_counts': '商品数',
- 'total_order_number': '订单支付数',
- },
- isDisable: false, // 是否禁用门店
- baseDialogVisible: false,
- shareDialogVisible: false,
- addressDialogVisible: false,
- form: {
- name: '',
- region: '',
- date1: '',
- date2: '',
- delivery: false,
- type: [],
- resource: '',
- desc: ''
- },
- captcha: '发送验证码',
- address: '',
- latitude: 0,
- longitude: 0,
- goods: {},
- setting: {},
- commission_type_map: {},
- coupon_type_map: {},
- level: {},
- expireDate: null,
- editExpireTime: false,
- cashierDistributionName: 'commission',
- areaName: 'area-detail',
- provinces: [],
- provinceInfo: {},
- citys: [],
- cityInfo: {},
- districts: [],
- districtInfo: {},
- streets: [],
- streetInfo: {},
- communitys: [],
- show_address:'',
- community_status: 0,
- goods_tabs: [{
- name: '全部',
- value: 'all'
- },
- {
- name: '销售中',
- value: 'onsale'
- },
- {
- name: '下架中',
- value: 'offline'
- },
- {
- name: '售罄',
- value: 'sell-out'
- },
- ],
- search_data: { // 筛选条件
- type: null,
- cats: [],
- start: null,
- end: null,
- goods_id: null,
- goods_name: null,
- goods_type: null,
- },
- list: [],
- listLoading: false,
- page: 1,
- pageCount: 0,
- group_buy_active_arr: {},
- selectedGoodIds: [],
- datetime: [],
- dialogFormVisible: false,
- ruleForm: {
- goods_id: '',
- attr: [],
- },
- goods_list: [],
- rules: {
- goods_id: [{
- required: true,
- message: '请选择商品',
- trigger: 'blur'
- }],
- },
- btnLoading: false,
- };
- },
- mounted: function() {
- this.store_id = getQuery('store_id');
- this.loadData();
- this.getList();
- },
- computed: {
- show_clear_search_btn: function() {
- return !isEmpty(this.search_data.cats) || !isEmpty(this.search_data.start) ||
- !isEmpty(this.search_data.end) || !isEmpty(this.search_data.goods_id) ||
- !isEmpty(this.search_data.goods_name);
- }
- },
- methods: {
- handleCancel() {
- this.addressDialogVisible = false; // 关闭弹框
- // 可以在这里添加更多的取消逻辑
- },
- tabClickHandles(tab, key) {
- this[key] = tab.name
- },
- changeTime(e) {
- // console.log(e)
- this.search_data.start = e[0]
- this.search_data.end = e[1]
- },
- clearSearch() {
- this.search_data.cats = [];
- this.search_data.start = null;
- this.search_data.end = null;
- this.search_data.goods_id = null;
- this.search_data.goods_name = null;
- this.datetime = [];
- this.getList();
- },
- mapEvent(e) {
- // console.log(e, '----')
- // this.basicForm.address = e.address;
- this.basicForm.latitude = e.lat;
- this.basicForm.longitude = e.long;
- // console.log(rst, 'rst ==================');
- this.$forceUpdate();
- },
- storeSwitch() { // 启用/禁用门店
- let self = this;
- self.switchStoreLoading = true;
- let status = null;
- if (self.isDisable) {
- status = 1;
- } else {
- status = 3;
- }
- request({
- params: {
- r: 'happiness/store/switch-status',
- },
- method: 'post',
- data: {
- store_id: self.store_id,
- status: status,
- }
- }).then(e => {
- self.switchStoreLoading = false;
- if (e.data.code == 0) {
- self.isDisable = !self.isDisable;
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- self.switchStoreLoading = false;
- // console.log(e);
- self.$message.error('网络错误');
- return false;
- });
- },
- storeEdit(name) { // 编辑
- this[name] = true;
- },
- storeDetailSelectedImg(e, key) { // 选中图片
- console.log(e, 'upload----')
- this.basicForm[key] = e[0].url;
- },
- // 删除图片
- storeDetailDeletePic(key) {
- this.basicForm[key] = '';
- },
- addressDialog(){
- this.addressDialogVisible = false;
- this.basicForm.province_id = this.provinceInfo.id;
- this.basicForm.city_id = this.cityInfo.id;
- this.basicForm.district_id = this.districtInfo.id;
- this.basicForm.street_id = this.streetInfo.id;
- this.basicForm.address = this.address
- let address = this.address;
- let reg = new RegExp(/(.*?(?:省|自治区|北京市|天津市|上海市|重庆市))+(.*?(?:市|自治州|地区|区划|县))+(.*?(?:市|区|县|镇|乡|街道))/);
- let rst = address.match(reg);
- let addr = '';
- if (rst) {
- addr += this.provinceInfo.name + '/' + this.cityInfo.name + '/' + this.districtInfo.name;
- }
- this.basicForm.addr = addr;
- this.basicForm.show_address = this.provinceInfo.name + this.cityInfo.name + this.districtInfo.name + this.address
- //如果有从经纬度获取值,那么拼接后面的
- },
- // sendCode() { // 发送验证码
- // this.captcha = 60
- // this.countDown()
- // },
- // // 倒计时
- // countDown() {
- // var timer = setInterval(() => {
- // this.captcha--
- // if (this.captcha <= 0) {
- // clearInterval(timer)
- // this.captcha = '重新获取'
- // }
- // }, 1000)
- // },
- // 输入值过滤处理
- changeHandle(key) {
- try {
- this.flierValue(this.activeName, key);
- } catch (err) {
- this.$message.error(err);
- let tabs = this.activeName.split('_');
- let formName = tabs[0] + 'Form';
- if (this[formName][key] < 0) {
- this[formName][key] = Math.abs(this[formName][key]);
- } else if (this[formName][key] > 100) {
- this[formName][key] = 0;
- }
- return false;
- }
- },
- // 过滤和处理值
- flierValue(group, key) {
- // console.log(group, key);
- let configs = {
- store_service_ratio: {
- text: `服务费比例取值在 0~100 之间`,
- max: '100',
- min: '0',
- },
- // expired_days: {
- // text: '请填写门店有效天数',
- // min: '0',
- // },
- // service_fee_ratio: {
- // text: `服务费比例取值在 0~100 之间`,
- // max: '100',
- // min: '0',
- // },
- };
- let datas = {
- basic_setting: this.basicForm,
- store_setting: this.storeForm,
- };
- let val = datas[group][key];
- if (configs[key]) {
- if (configs[key].max && val > parseInt(configs[key].max)) {
- throw new Error(configs[key].text);
- }
- if (configs[key].min && val < parseInt(configs[key].min)) {
- throw new Error(configs[key].text);
- }
- }
- },
- // 省市区三级联动
- regionChange(e, level) {
- let self = this;
- request({
- params: {
- r: 'happiness/store/get-regions',
- region_id: e.id,
- level: level,
- },
- method: 'get',
- }).then(e => {
- if (e.data.code == 0) {
- switch (level) {
- case 1:
- self.citys = e.data.data;
- this.cityInfo = {}
- this.districtInfo = {}
- break;
- case 2:
- self.districts = e.data.data;
- this.districtInfo = {}
- break;
- case 3:
- self.streets = e.data.data;
- this.streetInfo = {}
- break;
- }
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- self.$message.error('网络错误');
- return false;
- });
- },
- loadData() {
- let self = this;
- this.loading = true;
- request({
- params: {
- r: 'happiness/store/detail',
- store_id: self.store_id,
- },
- method: 'get'
- }).then(e => {
- // console.log('LLLLLLL: ', e);
- self.loading = false;
- if (e.data.code === 0) {
- self.provinces = e.data.data.provinces;
- //赋予初始值
- // this.provinceInfo = e.data.data.region_allInfo.provinceInfo
- // self.citys = e.data.data.region_alls.citys;
- // this.cityInfo = e.data.data.region_allInfo.cityInfo
- // console.log(self.citys)
- // console.log(district_id)
- // this.districtInfo = e.data.data.region_allInfo.districtInfo
- // self.districts = e.data.data.region_alls.districts;
- // this.streetInfo = e.data.data.region_allInfo.streetInfo
- // self.streets = e.data.data.region_alls.streets;
- // this.communityInfo = e.data.data.region_allInfo.communityInfo
- // self.communitys = e.data.data.region_alls.communitys;
- // console.log(self.provinces)
- if (e.data.data.basic_setting) {
- self.basicForm = e.data.data.basic_setting;
- if (1 == e.data.data.basic_setting.status) {
- this.isDisable = false;
- } else {
- this.isDisable = true;
- }
- }
- if (e.data.data.store_setting) {
- e.data.data.store_setting.status=0;
- self.storeForm = {...self.storeForm, ...e.data.data.store_setting};
- self.times = [e.data.data.store_setting.business_time_start, e.data.data.store_setting.business_time_end];
- }
- self.system_setting = e.data.data.configs;
- if (Object.keys(e.data.data.configs).length > 0 && self.storeForm.intra_city_distribution.is_alone == 0) {
- self.storeForm.intra_city_distribution.distribution_scope = e.data.data.configs.localtion_limit;
- self.storeForm.intra_city_distribution.delivery_fee = e.data.data.configs.delivery_fee;
- self.storeForm.intra_city_distribution.initial_delivery_amount = e.data.data.configs.delivery_amount;
- self.storeForm.intra_city_distribution.distance = e.data.data.configs.start_limit;
- self.storeForm.intra_city_distribution.distance_charge = e.data.data.configs.start_amount;
- self.storeForm.intra_city_distribution.every_distance = e.data.data.configs.add_limit;
- self.storeForm.intra_city_distribution.every_distance_charge = e.data.data.configs.add_amount;
- // console.log(self.storeForm);
- }
- // console.log(self.times);
- // console.log('self.storeForm: ', self.storeForm);
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- // console.log(e);
- self.$message.error('网络错误');
- });
- },
- // 配置提交
- submit(formName) {
- // console.log('5555555555: ', formName, this.activeName, this.storeForm);return null;
- let self = this;
- let keys = [];
- if ('basic_setting' == self.activeName) {
- keys = [];
- } else if ('store_setting' == self.activeName) {
- keys = ['store_service_ratio'];
- if (self.storeForm.password && self.storeForm.password != self.storeForm.repassword) {
- // console.log(self.storeForm.password);
- self.$message.error('两次输入密码不一致');
- return false;
- }
- }
- let forNum = keys.length;
- for (let i = 0; i < forNum; i++) {
- try {
- self.flierValue(self.activeName, keys[i]);
- } catch (err) {
- self.$message.error(err);
- return false;
- }
- }
- // console.log(self.$refs);return null;
- self.$refs[formName].validate(valid => {
- if (valid) {
- self.submitLoading = true;
- let activeName = self.activeName;
- let formData = {};
- formData[activeName] = self[formName];
- formData.group = activeName;
- formData.store_id = this.store_id;
- // console.log(formData);return null;
- request({
- params: {
- r: 'happiness/store/detail',
- },
- method: 'post',
- data: formData,
- }).then(e => {
- self.submitLoading = false;
- if (e.data.code === 0) {
- self.$message.success(e.data.msg);
- } else {
- self.$message.error(e.data.msg);
- return false;
- }
- }).catch(e => {
- self.submitLoading = false;
- console.log(e);
- self.$message.error('网络错误');
- return false;
- });
- } else {
- self.$message.error('参数验证未通过');
- return false;
- }
- });
- },
- handleClick(tab, event) {
- this.activeName = tab.name;
- if (this.activeName == 'goods_list') {
- this.getList();
- }
- },
- handleClick2(res, event) { //标签页切换
- if (this.search_data.status == res.name) return;
- this.search_data.type = res.name;
- this.getList();
- },
- // 时间改变回调
- selectTime(e) {
- // console.log('kkkkkkk ==== : ', e, this.times);
- if (e) {
- this.storeForm.business_time_start = this.times[0];
- this.storeForm.business_time_end = this.times[1];
- } else {
- this.times = null;
- this.storeForm.business_time_start = '';
- this.storeForm.business_time_end = '';
- }
- },
- // 选择图片
- selectedImg(e, key) {
- // console.log('ddddd: ', e, key);
- this.storeForm[key] = e[0].url;
- this.$forceUpdate();
- },
- // 删除图片
- delPic(key) {
- this.storeForm[key] = '';
- this.$forceUpdate();
- },
- getData(val, key) {
- this.storeForm[key] = val;
- },
- expireDateChange(e) {
- // console.log(e, '=============== ', this.basicForm.expire_time);
- this.basicForm.expire_time = Math.ceil(e / 1000) +86399;
- },
- onChangeStoreServiceFee(val) {
- console.log('onChangeStoreServiceFee', val)
- this.storeForm.store_settle_type = 2
- },
- changeRadioValue(e) {
- if (e == 1) {
- this.storeForm.intra_city_distribution = {...this.storeForm.intra_city_distribution, ...this.alone_setting};
- } else {
- this.alone_setting = {...this.alone_setting, ...this.storeForm.intra_city_distribution};
- this.alone_setting.is_alone = 1;
- this.storeForm.intra_city_distribution.distribution_scope = this.system_setting.localtion_limit;
- this.storeForm.intra_city_distribution.delivery_fee = this.system_setting.delivery_fee;
- this.storeForm.intra_city_distribution.initial_delivery_amount = this.system_setting.delivery_amount;
- this.storeForm.intra_city_distribution.distance = this.system_setting.start_limit;
- this.storeForm.intra_city_distribution.distance_charge = this.system_setting.start_amount;
- this.storeForm.intra_city_distribution.every_distance = this.system_setting.add_limit;
- this.storeForm.intra_city_distribution.every_distance_charge = this.system_setting.add_amount;
- // console.log(this.alone_setting);
- }
- },
- formatLocaltion(value) {
- let temp = this.formatNumber(value);
- this.storeForm.intra_city_distribution.initial_delivery_amount = temp;
- },
- formatNumber(value) {
- let temp = value.toString();
- temp = temp.replace(/。/g, ".");
- temp = temp.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
- temp = temp.replace(/^\./g, ""); //验证第一个字符是数字
- temp = temp.replace(/\.{2,}/g, ""); //只保留第一个, 清除多余的
- temp = temp.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
- temp = temp.replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3");
- return temp;
- },
- search() {
- this.page = 1;
- this.getList();
- },
- getList() {
- let self = this;
- let basic_params = {
- r: 'happiness/store-goods/get-store-goods',
- store_id: self.store_id,
- page: self.page,
- };
- params = Object.assign(basic_params, this.search_data);
- if (self.listLoading == false) {
- self.listLoading = true;
- request({
- params: params,
- method: 'get',
- }).then(e => {
- self.listLoading = false;
- if (e.data.code == 0) {
- self.list = e.data.data.list;
- self.group_buy_active_arr = e.data.data.group_buy_active_arr;
- self.pageCount = e.data.data.page_count;
- self.pay_success_jump = e.data.data.pay_success_jump;
- this.export_list = e.data.data.export_list;
- this.synchronize_goods_dialog = e.data.data.synchronize_goods_dialog
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- self.$message.error(e.data.msg);
- self.listLoading = false;
- });
- }
- },
- multipleOff() {
- let self = this;
- if (!self.selectedGoodIds.length) {
- self.$message.error('请先选择要下架的商品');
- return false;
- }
- self.listLoading = true;
- self.$confirm('是否确认下架所选中商品', '警告', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- request({
- params: {
- r: 'happiness/store-goods/store-goods-mutiple',
- },
- method: 'post',
- data: {
- good_ids: self.selectedGoodIds,
- store_id: self.store_id,
- type: 0,
- }
- }).then(e => {
- self.listLoading = false;
- if (e.data.code == 0) {
- self.$message.success('操作成功');
- self.getList();
- } else {
- self.$message.error(e.data.msg);
- return false;
- }
- }).catch(e => {
- self.listLoading = false;
- console.log(e);
- self.$message.error('网络错误');
- return false;
- });
- }).catch(() => {
- self.listLoading = false;
- console.log('已取消操作');
- return false;
- });
- },
- multipleOn() {
- let self = this;
- if (!self.selectedGoodIds.length) {
- self.$message.error('请先选择要上架的商品');
- return false;
- }
- self.listLoading = true;
- self.$confirm('是否确认上架所选中商品', '警告', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- request({
- params: {
- r: 'happiness/store-goods/store-goods-mutiple',
- },
- method: 'post',
- data: {
- good_ids: self.selectedGoodIds,
- store_id: self.store_id,
- type: 1,
- }
- }).then(e => {
- self.listLoading = false;
- if (e.data.code == 0) {
- self.$message.success('操作成功');
- self.getList();
- } else {
- self.$message.error(e.data.msg);
- return false;
- }
- }).catch(e => {
- self.listLoading = false;
- console.log(e);
- self.$message.error('网络错误');
- return false;
- });
- }).catch(() => {
- self.listLoading = false;
- console.log('已取消操作');
- return false;
- });
- },
- // 批量下架选中
- handleSelectionChange(val) {
- if (val.length) {
- this.selectedGoodIds = val.map((e) => {
- if (e.can_change_status == true) {
- return e.id;
- }
- });
- } else {
- this.selectedGoodIds = [];
- }
- },
- checkSelectable(row) {
- if (row.supplier_type != 4 && row.can_change_status == true) {
- return true;
- } else {
- return false;
- }
- },
- handle(type, data = null) {
- let id = data ? parseInt(data.id) : '';
- switch (type) {
- case 'edit':
- this.ruleForm.id = data.id;
- this.ruleForm.goods_id = data.goods_id;
- this.ruleForm.attr = data.yunAttr;
- this.goods_list = data.goods;
- console.log('goods',data);
- this.dialogFormVisible = true;
- break;
- case 'destroy':
- param = {
- id: data.id,
- store_id: this.store_id,
- type
- };
- url = 'happiness/store-goods/del-goods';
- this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {
- type: 'warning'
- }).then(() => {
- this.send(param, url)
- })
- break;
- case 'is_on_sale':
- param = {
- good_ids: id,
- type: data.is_on_sale,
- store_id: this.store_id,
- };
- url = 'happiness/store-goods/store-goods-mutiple';
- operate_type = data.is_on_sale == 0 ? '下架' : '上架';
- this.$confirm('是否' + operate_type + '该商品?', '警告', {
- type: 'warning'
- }).then(() => {
- this.send(param, url)
- }).catch(() => {
- this.getList();
- });
- break;
- }
- this.cancelEdit(type);
- },
- send(params, url) {
- let self = this;
- request({
- params: {
- r: url,
- },
- method: 'post',
- data: params
- }).then(e => {
- if (e.data.code == 0) {
- self.$message.success(e.data.msg);
- self.getList();
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- },
- cancelEdit(type) {
- switch (type) {
- case 'sort':
- this.sort = 0;
- this.sort_id = 0;
- break;
- case 'goods_name':
- this.goods_name = '';
- this.goods_name_id = 0;
- break;
- }
- },
- pagination(currentPage) {
- let self = this;
- self.page = currentPage;
- self.getList();
- },
- sortChange(row) {
- if (row.prop) {
- this.search_data.sort_field = row.prop;
- this.search_data.sort_type = row.order == "descending" ? 'desc' : 'asc';
- } else {
- this.search_data.sort_prop = null;
- this.search_data.sort_type = null;
- }
- this.getList();
- },
- // 选中商品处理
- goodsSelect(param) {
- console.log(param);
- this.goods_list.push({
- id: param.id,
- stock: param.stock,
- goods_name: param.goods_name,
- cover_pic: param.cover_pic,
- });
- this.ruleForm.goods_id = param.goods_id;
- this.ruleForm.attr = param.attr;
- },
- // 删除商品
- delFun(index) {
- this.goods_list.splice(index, 1)
- this.ruleForm.goods_id = '';
- },
- submitForm(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- let self = this;
- self.btnLoading = true;
- this.ruleForm.store_id = getQuery('store_id')
- request({
- params: {
- r: 'happiness/store-goods/edit-goods',
- },
- method: 'post',
- data: self.ruleForm,
- }).then(e => {
- self.btnLoading = false;
- if (e.data.code == 0) {
- this.dialogFormVisible = false;
- //添加完成之后初始化
- self.$message.success('保存成功');
- self.getList();
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- self.btnLoading = false;
- console.log(e);
- self.$message.error('网络错误');
- return false;
- });
- }
- });
- },
- addGoods() {
- this.ruleForm = {
- goods_id: '',
- attr: [],
- },
- this.goods_list = [];
- this.dialogFormVisible = true
- }
- },
- });
- </script>
- <style>
- .grid-box {
- padding: 0 40px;
- background: #fff;
- border-radius: 0 0 4px 4px;
- }
- .grid-item {
- height: 130px;
- }
- .grid-text {
- font-size: 15px;
- }
- .grid-val {
- font-size: 20px;
- padding-top: 10px;
- }
- .grid-icon {
- color: #999;
- cursor: pointer;
- font-size: 18px;
- }
- .store-card {
- margin-top: 15px;
- }
- .store-card.el-card {
- border: 0;
- }
- .store-card-body .store-name {
- padding-left: 10px;
- }
- .store-card-body .el-descriptions__body {
- padding: 20px 40px;
- }
- .store-send-code {
- padding-left: 10px;
- font-size: 12px;
- cursor: pointer;
- }
- .el-tabs__header {
- padding: 0 20px;
- height: 56px;
- line-height: 56px;
- background-color: #fff;
- margin-bottom: 0;
- }
- .title {
- padding: 0px 8px;
- border-left: 5px solid #1479F0;
- background-color: #fff;
- font-size: 18px;
- position: relative;
- left: 32px;
- margin: 20px 0;
- }
- .form-body {
- background-color: #fff;
- padding: 20px 50% 20px 0;
- }
- .button-item {
- padding: 9px 25px;
- margin-bottom: 15px;
- }
- .form-body .item {
- width: 300px;
- margin-bottom: 50px;
- margin-right: 25px;
- }
- .item-img {
- height: 550px;
- padding: 25px 10px;
- border-radius: 30px;
- border: 1px solid #CCCCCC;
- background-color: #fff;
- }
- .item .el-form-item {
- width: 300px;
- margin: 20px auto;
- }
- .left-setting-menu {
- width: 260px;
- }
- .left-setting-menu .el-form-item {
- height: 60px;
- padding-left: 20px;
- display: flex;
- align-items: center;
- margin-bottom: 0;
- cursor: pointer;
- }
- .left-setting-menu .el-form-item .el-form-item__label {
- cursor: pointer;
- }
- .left-setting-menu .el-form-item.active {
- background-color: #F3F5F6;
- border-top-left-radius: 10px;
- width: 105%;
- border-bottom-left-radius: 10px;
- }
- .left-setting-menu .el-form-item .el-form-item__content {
- margin-left: 0 !important
- }
- .no-radius {
- border-top-left-radius: 0 !important;
- }
- .reset {
- position: absolute;
- top: 3px;
- left: 90px;
- }
- .app-tip {
- position: absolute;
- right: 24px;
- top: 16px;
- height: 72px;
- line-height: 72px;
- max-width: calc(100% - 78px);
- }
- .app-tip:before {
- content: ' ';
- width: 0;
- height: 0;
- border-color: inherit;
- position: absolute;
- top: -32px;
- right: 100px;
- border-width: 16px;
- border-style: solid;
- }
- .tip-content {
- display: block;
- white-space: nowrap;
- width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- margin: 0 28px;
- font-size: 28px;
- }
- .btn-abs {
- position: absolute;
- top: 12px;
- right: 18px;
- }
- .form-body .app-share {
- padding-top: 12px;
- border-top: 1px solid #e2e2e2;
- margin-top: -20px;
- }
- .form-body .app-share .app-share-bg {
- position: relative;
- width: 310px;
- height: 360px;
- background-repeat: no-repeat;
- background-size: contain;
- background-position: center
- }
- .form-body .app-share .app-share-bg .title {
- width: 160px;
- height: 29px;
- line-height: 1;
- word-break: break-all;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- }
- .form-body .app-share .app-share-bg .pic-image {
- background-repeat: no-repeat;
- background-position: 0 0;
- background-size: cover;
- width: 160px;
- height: 130px;
- }
- .cashier-tabs .el-tabs__header {
- padding: 0;
- height: 45px;
- line-height: 45px;
- /* background-color: #F5F7FA; */
- margin-bottom: 0;
- }
- .cashier-tabs .el-tabs__item {
- height: 43px;
- line-height: 43px;
- }
- .cashier-tabs .el-tabs__content {
- margin-top: 20px;
- }
- .form-body {
- background-color: #fff;
- padding: 20px 50% 20px 0;
- }
- .button-item {
- margin-top: 12px;
- padding: 9px 25px;
- }
- .form-body .item {
- width: 300px;
- margin-bottom: 50px;
- margin-right: 25px;
- }
- .item-img {
- height: 550px;
- padding: 25px 10px;
- border-radius: 30px;
- border: 1px solid #CCCCCC;
- background-color: #fff;
- }
- .item .el-form-item {
- width: 300px;
- margin: 20px auto;
- }
- .left-setting-menu {
- width: 260px;
- }
- .left-setting-menu .el-form-item {
- height: 60px;
- padding-left: 20px;
- display: flex;
- align-items: center;
- margin-bottom: 0;
- cursor: pointer;
- }
- .left-setting-menu .el-form-item .el-form-item__label {
- cursor: pointer;
- }
- .left-setting-menu .el-form-item.active {
- background-color: #F3F5F6;
- border-top-left-radius: 10px;
- width: 105%;
- border-bottom-left-radius: 10px;
- }
- .left-setting-menu .el-form-item .el-form-item__content {
- margin-left: 0 !important
- }
- .no-radius {
- border-top-left-radius: 0 !important;
- }
- .del-btn {
- position: absolute;
- right: -8px;
- top: -8px;
- padding: 4px 4px;
- }
- .reset {
- position: absolute;
- top: 3px;
- left: 90px;
- }
- .app-tip {
- position: absolute;
- right: 24px;
- top: 16px;
- height: 72px;
- line-height: 72px;
- max-width: calc(100% - 78px);
- }
- .app-tip:before {
- content: ' ';
- width: 0;
- height: 0;
- border-color: inherit;
- position: absolute;
- top: -32px;
- right: 100px;
- border-width: 16px;
- border-style: solid;
- }
- .tip-content {
- display: block;
- white-space: nowrap;
- width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- margin: 0 28px;
- font-size: 28px;
- }
- .add-image-btn {
- width: 100px;
- height: 100px;
- color: #419EFB;
- border: 1px solid #e2e2e2;
- cursor: pointer;
- }
- .addon-no-install {
- margin-top: 15px;
- margin-left: 40px;
- }
- .desc-container {
- padding: 20px;
- }
- .el-descriptions__body {
- color: #606266;
- background-color: #FFF;
- padding: 40px;
- }
- .el-descriptions__body .el-descriptions__table .el-descriptions-item__cell {
- line-height: 3;
- }
- .stat-item-label {
- font-size: 18px;
- line-height: 3;
- /* width: 38%; */
- }
- .stat-itme-content {
- font-size: 18px;
- line-height: 3;
- }
- .delele-img-btn {
- position: absolute;
- left: 64px;
- top: -13px;
- }
- .goods-box {
- position: relative;
- left: -104px;
- }
- .mode-switch-btn {
- position: relative;
- left: -106px;
- }
- .mode-switch-box {
- margin-bottom: 30px;
- }
- .form-body {
- padding: 10px 20px 20px;
- background-color: #fff;
- margin-bottom: 30px;
- }
- </style>
|