liudan 10 months ago
parent fff86d3b12
commit fb86d4f2a0
  1. 8
      view/admin/src/api/marketing.js
  2. 63
      view/admin/src/views/marketing/platformCoupon/couponList/index.vue

@ -515,3 +515,11 @@ export function assetsLogList(data) {
export function borderDelete(id) { export function borderDelete(id) {
return request.delete(`activity/border/delete/${id}`) return request.delete(`activity/border/delete/${id}`)
} }
// 优惠券选择商品
export function couponShopping(id) {
return request.get(`store/coupon/product/${id}`)
}
// 更改优惠券商品
export function setCouponShopping(id,data) {
return request.post(`store/coupon/update_product/${id}`, { data })
}

@ -198,6 +198,7 @@
@click="handleDelete(scope.row.coupon_id, scope.$index)" @click="handleDelete(scope.row.coupon_id, scope.$index)"
>删除</el-button >删除</el-button
> >
<el-button type="text" size="small" @click="getCouponShopping(scope.row)">选择商品</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -465,6 +466,25 @@
/> />
</div> </div>
</el-dialog> </el-dialog>
<el-dialog title="提示" :visible.sync="shopDialog" width="80%">
<el-table :data="shopList" style="width: 100%" @selection-change="handleSelectionChange" >
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column type="index" label="序号"></el-table-column>
<el-table-column prop="store_name" align="center" label="商品名称"></el-table-column>
<el-table-column prop="price" align="center" label="商品价格"></el-table-column>
<el-table-column prop="image" align="center" label="商品主图">
<template slot-scope="scope">
<img :src="scope.row.image" alt="" style="width:100px;height:100px;">
</template>
</el-table-column>
<el-table-column prop="stock" align="center" label="库存"></el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="shopDialog = false"> </el-button>
<el-button type="primary" @click="setCouponShoppingHandle"> </el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
@ -486,6 +506,8 @@ import {
platIssueApi, platIssueApi,
couponIssueStatusApi, couponIssueStatusApi,
platRelateProLst, platRelateProLst,
couponShopping,
setCouponShopping
} from "@/api/marketing"; } from "@/api/marketing";
import { import {
issueApi, issueApi,
@ -539,12 +561,53 @@ export default {
}, },
couponDetail: {}, couponDetail: {},
type: 0, type: 0,
shopDialog:false,
shopList:[],
multipleSelection: [],
selectedCoupon:{}
}; };
}, },
mounted() { mounted() {
this.getList(1); this.getList(1);
}, },
methods: { methods: {
handleSelectionChange(val){
this.multipleSelection = val.map(item=>{
return item.product_id
})
},
setCouponShoppingHandle(){
setCouponShopping(this.selectedCoupon.coupon_id,{product_id:this.multipleSelection.join()}).then((res) => {
this.getList(1)
this.shopDialog = false;
}).catch(({ message }) => {
this.$message.error(message);
});
this.multipleSelection
},
getCouponShopping(row){
this.selectedCoupon = row;
couponShopping(row.coupon_id).then(res=>{
let shopList = []
res.data.list.forEach(item=>{
let obj = {}
if(item.product){
Object.keys(item.product).forEach(p=>{
this.$set(obj,p,item.product[p])
})
shopList.push(obj)
}
})
this.shopList = shopList;
this.shopDialog = true;
})
},
// //
handleDelete(id, idx) { handleDelete(id, idx) {
this.$modalSureDelete(`删除优惠券将无法恢复,请谨慎操作!`).then(() => { this.$modalSureDelete(`删除优惠券将无法恢复,请谨慎操作!`).then(() => {

Loading…
Cancel
Save