Commit cfa52c5f authored by 郭志伟's avatar 郭志伟

Merge branch 'feat/discount' into 'master'

促销折扣上线

See merge request !40
parents 19eebfbc ee5902cd
...@@ -7,6 +7,7 @@ const hostMap = { ...@@ -7,6 +7,7 @@ const hostMap = {
shenceUrl: `${protocol}//bn.xyqb.com/sa?project=production`, shenceUrl: `${protocol}//bn.xyqb.com/sa?project=production`,
opapiHost: `${protocol}//opapi.q-gp.com`, opapiHost: `${protocol}//opapi.q-gp.com`,
qiniuUpHost: `${protocol}//up-z0.qiniup.com`, qiniuUpHost: `${protocol}//up-z0.qiniup.com`,
kdspHost: `${protocol}//talos.q-gp.com`
}; };
if (EASY_ENV_IS_BROWSER) { if (EASY_ENV_IS_BROWSER) {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<Tooltip placement="top" content="两列"> <Tooltip placement="top" content="两列">
<Button type="ghost" icon="ios-pause" @click="select(2)"></Button> <Button type="ghost" icon="ios-pause" @click="select(2)"></Button>
</Tooltip> </Tooltip>
<Tooltip placement="top" content="多列"> <Tooltip placement="top" content="多列" v-show="!hide3Column">
<Button type="ghost" icon="navicon-round" @click="select(3)" ></Button> <Button type="ghost" icon="navicon-round" @click="select(3)" ></Button>
</Tooltip> </Tooltip>
</div> </div>
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
export default { export default {
props: { props: {
value: Number, value: Number,
hide3Column: {
type: Boolean,
default: false
}
}, },
data() { data() {
return { return {
......
<template>
<div class="discountGoodsContainer">
<div class="discountGoodsItem" v-for="(item, index) in goods" :key="index">
<p>商品{{index + 1}}<span v-if="item.status == 2">(已隐藏,商品已下架)</span></p>
<Form @submit.native.prevent ref="formCustom" :model="item" :label-width="90" label-position="left">
<FormItem label="sku_no" prop="skuNo">
<Input v-model="item.skuNo" placeholder="请输入商品sku编码" @on-focus="setPrevVal(item.skuNo)" @on-blur="getSkuInfo(item.skuNo, index)"></Input>
</FormItem>
<FormItem label="商品名称" prop="skuName">
<Input v-model="item.skuName" placeholder="请输入商品名称"></Input>
</FormItem>
<FormItem label="商品横幅文案" prop="subtitle">
<Input v-model="item.subtitle" placeholder="请输入商品横幅文案"></Input>
</FormItem>
<FormItem label="商品标签文案" prop="tag">
<Input v-model="item.tag" placeholder="请输入商品标签文案"></Input>
</FormItem>
<FormItem label="商品标签文案颜色" prop="tagColor">
<ColorSelector v-model="item.goodsTagFontColor" @input="updateStyle($event, 'tagColor', item)"></ColorSelector>
</FormItem>
<FormItem label="商品标签背景" prop="tagBg" title="要求尺寸:134px * 46px">
<Upload v-model="item.goodsTagBgImg" @change="updateStyle($event, 'tagBg', item)"></Upload>
</FormItem>
</Form>
<Button type="error" @click="del(index)" class="deleteGood">删除</Button>
</div>
<Button type="dashed" icon="plus-round" @click="add">添加商品</Button>
<!-- <Button type="primary" @click="save">保存</Button> -->
</div>
</template>
<script>
import ColorSelector from '@editor/component/DynamicForm/component/ColorSelector/index.vue';
import Upload from '@editor/component/DynamicForm/component/Upload/index.vue';
import operationApi from '@api/operation.api';
export default {
props: {
value: {
type: Array,
default: () => []
}
},
components: {
Upload,
ColorSelector
},
data() {
return {
goods: [],
prevEditSkuNo: ''
}
},
watch: {
value(val) {
this.goods = val;
},
goods: {
handler(val) {
this.$emit('input', val);
},
deep: true
}
},
created() {
this.goods = JSON.parse(JSON.stringify(this.value));
},
methods: {
setPrevVal(skuNo) {
this.prevEditSkuNo = skuNo;
},
async getSkuInfo(skuNo, index) {
if (skuNo === this.prevEditSkuNo) return;
if (isNaN(parseInt(skuNo))) return;
const res = await operationApi.getGoods({
skus: [skuNo]
});
const result = res.skus[0];
if (!result) return;
const item = {
skuNo: result.skuNo || '',
skuName: result.skuName || '',
skuImg: result.skuUrl || '',
marketPrice: result.marketPrice || '',
salePrice: result.salePrice || '',
goodsTagFontColor: this.goods[index].goodsTagFontColor || '',
subtitle: this.goods[index].subtitle || '',
tag: this.goods[index].tag || '',
goodsTagBgImg: this.goods[index].goodsTagBgImg || '',
status: result.status || 2
}
this.$set(this.goods, index, item);
// const goods = JSON.parse(JSON.stringify(this.goods));
// goods[index] = item;
// this.goods = goods;
console.log(this.goods, index);
},
updateStyle(e, key, item) {
item[key] = e;
},
add() {
this.goods.push({
skuNo: '',
skuName: '',
skuImg: '',
subtitle: '',
marketPrice: '',
salePrice: '',
tag: '',
goodsTagFontColor: '',
goodsTagBgImg: ''
})
},
del(index) {
this.goods.splice(index, 1)
}
}
}
</script>
<style scoped lang="less">
.discountGoodsContainer{
.discountGoodsItem{
border: 1px solid #dddee1;
border-radius: 4px;
margin-bottom: 10px;
padding: 5px;
.deleteGood{
width: 100%;
margin-top: 10px;
}
/deep/ .ivu-form-item{
margin-bottom: 10px;
}
}
}
</style>
...@@ -5,6 +5,7 @@ import ContextMenuMixin from '@editor/mixins/contextMenu.mixin'; ...@@ -5,6 +5,7 @@ import ContextMenuMixin from '@editor/mixins/contextMenu.mixin';
import DynamicFormMixin from './component/mixins/dynamicForm.mixin'; import DynamicFormMixin from './component/mixins/dynamicForm.mixin';
import Upload from './component/Upload/index.vue'; import Upload from './component/Upload/index.vue';
import ColorSelector from './component/ColorSelector/index.vue'; import ColorSelector from './component/ColorSelector/index.vue';
import DiscountGoodsSelector from './component/DiscountGoodsSelector/index.vue';
import BaseSelect from './component/BaseSelect/index.vue'; import BaseSelect from './component/BaseSelect/index.vue';
import ComponentSelect from './component/ComponentSelect/index.vue'; import ComponentSelect from './component/ComponentSelect/index.vue';
import FormList from './component/FormList/index.vue'; import FormList from './component/FormList/index.vue';
...@@ -16,7 +17,7 @@ import ColumnSelector from './component/ColumnSelector/index.vue'; ...@@ -16,7 +17,7 @@ import ColumnSelector from './component/ColumnSelector/index.vue';
import { resizeDiv, getStyle } from '@/service/utils.service'; import { resizeDiv, getStyle } from '@/service/utils.service';
import EventBus from '@service/eventBus.service'; import EventBus from '@service/eventBus.service';
@Component({ components: { Upload, ColorSelector, BaseSelect, FormList, Textarea, Number, ComponentSelect, GoodsTableModal, CouponTableModal, ColumnSelector }, name: 'DynamicForm' }) @Component({ components: { Upload, ColorSelector, BaseSelect, FormList, Textarea, Number, ComponentSelect, GoodsTableModal, CouponTableModal, ColumnSelector, DiscountGoodsSelector }, name: 'DynamicForm' })
export default class DynamicForm extends Mixins(ContextMenuMixin, DynamicFormMixin) { export default class DynamicForm extends Mixins(ContextMenuMixin, DynamicFormMixin) {
@State(state => state.editor.curEleIndex) curEleIndex; @State(state => state.editor.curEleIndex) curEleIndex;
@State(state => state.editor.curChildIndex) curChildIndex; @State(state => state.editor.curChildIndex) curChildIndex;
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
<component :is="getComponent(child.type)" :options="child.options" :formControl="child.formControl" :limit-name="child.type === 'FormList' && curElement.name === 'cs-goods-tabs' ? 'cs-goods' : ''" v-model="form[child.key]" /> <component :is="getComponent(child.type)" :options="child.options" :formControl="child.formControl" :limit-name="child.type === 'FormList' && curElement.name === 'cs-goods-tabs' ? 'cs-goods' : ''" v-model="form[child.key]" />
</FormItem> </FormItem>
</div> </div>
<FormItem class="Df-component-formitem" v-else :label="item.name" > <FormItem class="Df-component-formitem" v-else :label="item.name" :title="item.desc || ''">
<component :is="getComponent(item.type)" :options="item.options" :formControl="item.formControl" :limit-name="item.type === 'ComponentSelect' && curElement.name === 'cs-goods-tabs' ? 'cs-goods' : ''" v-model="form[item.key]" /> <component :hide3Column="curElement.name === 'cs-discount' && item.key ==='column'" :is="getComponent(item.type)" :options="item.options" :formControl="item.formControl" :limit-name="item.type === 'ComponentSelect' && curElement.name === 'cs-goods-tabs' ? 'cs-goods' : ''" v-model="form[item.key]" />
</FormItem> </FormItem>
</template> </template>
</Form> </Form>
......
...@@ -6,7 +6,7 @@ import createStore from '@store/index'; ...@@ -6,7 +6,7 @@ import createStore from '@store/index';
import createRouter from './router/index'; import createRouter from './router/index';
import entry from '@editor/view/home/index.vue'; import entry from '@editor/view/home/index.vue';
import './public-path'; import './public-path';
Vue.config.devtools = true
const create = function(initState) { const create = function(initState) {
console.log('initState', initState); console.log('initState', initState);
const store = createStore(initState); const store = createStore(initState);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment