添加赠送商品
This commit is contained in:
parent
ce546e09b2
commit
21a9548e45
|
|
@ -216,7 +216,9 @@ export default {
|
||||||
startTime: this.query.createdAt[0],
|
startTime: this.query.createdAt[0],
|
||||||
endTime: this.query.createdAt[1],
|
endTime: this.query.createdAt[1],
|
||||||
cateId: this.query.cateId,
|
cateId: this.query.cateId,
|
||||||
proName: this.query.proName
|
proName: this.query.proName,
|
||||||
|
|
||||||
|
type: this.orderType,
|
||||||
});
|
});
|
||||||
this.payCountList = res;
|
this.payCountList = res;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
|
|
@ -20,20 +20,40 @@
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-switch v-model="form.isDel" active-value="0" inactive-value="1"></el-switch>
|
<el-switch v-model="form.isDel" active-value="0" inactive-value="1"></el-switch>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="赠送商品">
|
||||||
|
<div>
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="$refs.shopListRef.show([...productIds])">
|
||||||
|
添加商品
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="shop_list">
|
||||||
|
<div class="item_wrap" v-for="(item, index) in productIds" :key="item.id"
|
||||||
|
@click="productIds.splice(index, 1)">
|
||||||
|
<div class="item" :data-index="index + 1">
|
||||||
|
<el-image :src="item.coverImg" style="width: 100%;height: 100%;"></el-image>
|
||||||
|
</div>
|
||||||
|
<div class="name">{{ item.name }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<shopList ref="shopListRef" @success="slectShop" />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import handselTypes from '../handselTypes'
|
import handselTypes from '../handselTypes'
|
||||||
import { modityActivate } from '@/api/shop'
|
import { modityActivate } from '@/api/shop'
|
||||||
|
import shopList from '@/components/shopList'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: { shopList },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
|
|
@ -48,6 +68,7 @@ export default {
|
||||||
handselType: 'GD',
|
handselType: 'GD',
|
||||||
isDel: '0'
|
isDel: '0'
|
||||||
},
|
},
|
||||||
|
productIds: [],
|
||||||
resetForm: '',
|
resetForm: '',
|
||||||
rules: {
|
rules: {
|
||||||
minNum: [
|
minNum: [
|
||||||
|
|
@ -71,6 +92,27 @@ export default {
|
||||||
this.resetForm = { ...this.form }
|
this.resetForm = { ...this.form }
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
slectShop(res) {
|
||||||
|
if (this.productIds.length) {
|
||||||
|
res.map(async item => {
|
||||||
|
if (!await this.checkShop(item.id)) {
|
||||||
|
this.productIds.push({ ...item })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.productIds = res
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 判断是否存在重复商品
|
||||||
|
checkShop(id) {
|
||||||
|
let falg = false
|
||||||
|
this.productIds.map(item => {
|
||||||
|
if (item.id == id) {
|
||||||
|
falg = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return falg
|
||||||
|
},
|
||||||
// 确认选择商品分类
|
// 确认选择商品分类
|
||||||
classifySuccess(e) {
|
classifySuccess(e) {
|
||||||
this.form.config.categoryList = e
|
this.form.config.categoryList = e
|
||||||
|
|
@ -112,4 +154,72 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.shop_list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
.item_wrap {
|
||||||
|
$size: 80px;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
$radius: 4px;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
border-radius: $radius;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-top: 10px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: attr(data-index);
|
||||||
|
font-size: 12px;
|
||||||
|
height: 20px;
|
||||||
|
display: flex;
|
||||||
|
padding: 0 10px;
|
||||||
|
border-radius: 0 0 $radius 0;
|
||||||
|
align-items: center;
|
||||||
|
background-color: rgba(0, 0, 0, 0.3);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
color: #fff;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '删除';
|
||||||
|
font-size: 12px;
|
||||||
|
width: 100%;
|
||||||
|
height: 20px;
|
||||||
|
display: flex;
|
||||||
|
padding: 0 10px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: rgba(0, 0, 0, 0.3);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
color: #fff;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 10;
|
||||||
|
transition: all .1s ease-in-out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
width: $size;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -22,11 +22,11 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getlist()
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
show() {
|
show() {
|
||||||
this.isshow = true
|
this.isshow = true
|
||||||
|
this.getlist()
|
||||||
},
|
},
|
||||||
async getlist() {
|
async getlist() {
|
||||||
let res = await getwxacode({
|
let res = await getwxacode({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue