分佣:商品详情增加绑定用户

pull/1/MERGE
YunaiV 2023-09-09 22:19:12 +08:00
parent 15b7e3d94c
commit ad4eb04f49
5 changed files with 30 additions and 15 deletions

View File

@ -51,3 +51,10 @@ export function createBrokerageWithdraw(data) {
export function getBrokerageRecordPage(data) { export function getBrokerageRecordPage(data) {
return request.get('app-api/trade/brokerage-record/page', data); return request.get('app-api/trade/brokerage-record/page', data);
} }
// 获得商品的分销金额
export function getProductBrokeragePrice(spuId) {
return request.get('app-api/trade/brokerage-record/get-product-brokerage-price', {
spuId
});
}

View File

@ -1,5 +1,5 @@
<template> <template>
<view class='sharing-packets' :class='sharePacket.isState ? "on":""'> <view class='sharing-packets' :class='!sharePacket.enabled ? "on":""'>
<view class='iconfont icon-guanbi' @click="closeShare"></view> <view class='iconfont icon-guanbi' @click="closeShare"></view>
<view class='line'></view> <view class='line'></view>
<view class='sharing-con' @click='goShare'> <view class='sharing-con' @click='goShare'>
@ -21,7 +21,7 @@
type: Object, type: Object,
default: function() { default: function() {
return { return {
isState: true, enabled: true,
priceName:'' // priceName:'' //
} }
} }

View File

@ -1,6 +1,6 @@
// let domain = 'http://apif.java.crmeb.net' let domain = 'http://apif.java.crmeb.net'
let domain = 'http://127.0.0.1:48080' // let domain = 'http://127.0.0.1:48080'
module.exports = { module.exports = {
// 请求域名 格式: https://您的域名 // 请求域名 格式: https://您的域名

View File

@ -293,6 +293,7 @@
import * as CouponApi from '@/api/promotion/coupon.js'; import * as CouponApi from '@/api/promotion/coupon.js';
import * as PromotionActivityApi from '@/api/promotion/activity.js'; import * as PromotionActivityApi from '@/api/promotion/activity.js';
import * as TradeCartApi from '@/api/trade/cart.js'; import * as TradeCartApi from '@/api/trade/cart.js';
import * as BrokerageAPI from '@/api/trade/brokerage.js'
import * as Util from '@/utils/util.js'; import * as Util from '@/utils/util.js';
import * as ProductUtil from '@/utils/product.js'; import * as ProductUtil from '@/utils/product.js';
// #ifdef MP // #ifdef MP
@ -372,7 +373,7 @@
posterbackgd: '/static/images/posterbackgd.png', // posterbackgd: '/static/images/posterbackgd.png', //
storeImage: '', // storeImage: '', //
sharePacket: { // sharePacket: { //
isState: true, // enabled: true, //
}, },
actionSheetHidden: true, // actionSheetHidden: true, //
@ -421,11 +422,11 @@
// #ifdef MP || APP-PLUS // #ifdef MP || APP-PLUS
// id // id
// TODO //
setTimeout(()=>{ setTimeout(()=>{
if(options.spread){ if(options.spread){
app.globalData.spread = options.spread; app.globalData.spread = options.spread;
spread(options.spread).then(res => {}) BrokerageAPI.bindBrokerageUser(options.spread).then(res => {})
} }
},2000) },2000)
// #endif // #endif
@ -448,9 +449,9 @@
let mapeMpQrCodeValue = this.$util.formatMpQrCodeData(qrCodeValue); let mapeMpQrCodeValue = this.$util.formatMpQrCodeData(qrCodeValue);
app.globalData.spread = mapeMpQrCodeValue.spread; app.globalData.spread = mapeMpQrCodeValue.spread;
this.id = mapeMpQrCodeValue.id; this.id = mapeMpQrCodeValue.id;
// TODO code //
setTimeout(()=>{ setTimeout(()=>{
spread(mapeMpQrCodeValue.spread).then(res => {}).catch(res => {}) BrokerageAPI.bindBrokerageUser(mapeMpQrCodeValue.spread).then(res => {}).catch(res => {})
},2000) },2000)
} else { } else {
this.id = options.id; this.id = options.id;
@ -513,8 +514,8 @@
this.$set(this, 'skuMap', ProductUtil.convertProductSkuMap(skus)); this.$set(this, 'skuMap', ProductUtil.convertProductSkuMap(skus));
// // TODO // // TODO
this.$set(this.sharePacket, 'priceName', res.data.priceName); // this.$set(this.sharePacket, 'priceName', res.data.priceName);
this.$set(this.sharePacket, 'isState', Math.floor(res.data.priceName) === 0); // this.$set(this.sharePacket, 'enabled', Math.floor(res.data.priceName) === 0);
// //
PromotionActivityApi.getActivityListBySpuId(this.id).then(res => { PromotionActivityApi.getActivityListBySpuId(this.id).then(res => {
@ -532,6 +533,7 @@
if (this.isLogin) { if (this.isLogin) {
this.getCartCount(); this.getCartCount();
this.isFavoriteExists(); this.isFavoriteExists();
this.getBrokeragePrice();
// #ifdef H5 // #ifdef H5
this.make(); this.make();
this.ShareInfo(); this.ShareInfo();
@ -566,6 +568,13 @@
}); });
}) })
}, },
getBrokeragePrice: function() {
BrokerageAPI.getProductBrokeragePrice(this.id).then(res => {
// this.sharePacket = res.data
// console.log(this.sharePacket)
this.$set(this.sharePacket, 'isState', false);
});
},
/** /**
* 查找默认选中的 sku设置到 attr.productSelect * 查找默认选中的 sku设置到 attr.productSelect
* *
@ -698,7 +707,6 @@
TradeCartApi.addCart({ TradeCartApi.addCart({
count: sku.cart_num, count: sku.cart_num,
skuId: sku.id, skuId: sku.id,
addStatus: true // TODO addStatus
}).then(res => { }).then(res => {
// attr // attr
this.attr.cartAttr = false; this.attr.cartAttr = false;
@ -1191,7 +1199,7 @@
* 关闭分销的弹窗 * 关闭分销的弹窗
*/ */
closeChange: function() { closeChange: function() {
this.$set(this.sharePacket, 'isState', true); this.$set(this.sharePacket, 'enabled', false);
}, },
// ========== nav ========== // ========== nav ==========