修改:下单页面补货额度减免信息区分为 冠名品牌减免和其他品牌减免
增加:进货商品列表页面增加可用冠名品牌额度和其他品牌额度;增加商品品牌类型(冠名品牌or其他品牌)
This commit is contained in:
parent
166b0237c1
commit
5c0b61202e
|
|
@ -557,7 +557,10 @@ export function storeLogin(data) {
|
|||
export function storeLoginSimulation(merId) {
|
||||
return request.get(`store/merchant/simulation_login/${merId}`);
|
||||
}
|
||||
|
||||
// 获取商户额度信息
|
||||
export function merchantQuotaInfo(merId) {
|
||||
return request.get(`store/merchant/quotaInfo/${merId}`);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@
|
|||
</view>
|
||||
<view class="info">
|
||||
<view class="title">{{ item.store_name }}</view>
|
||||
<view class="brand">
|
||||
<view class="title-brand brand-box" v-if="quotaInfo.mer_brand_name.length > 0 && quotaInfo.mer_brand_name === item.brand_name">冠名品牌</view>
|
||||
<view class="other-brand brand-box" v-else>其他品牌</view>
|
||||
</view>
|
||||
<view class="price">¥{{ item.price }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -60,16 +64,22 @@
|
|||
</view>
|
||||
<!--结算按钮-->
|
||||
<view class="settlement">
|
||||
<view class="left">
|
||||
<text class="iconfont icon-gouwuche-mendian">
|
||||
<text class="total-num" v-if="totalNum > 0">{{ totalNum > 99 ? '99+' : totalNum }}</text>
|
||||
</text>
|
||||
<view class="total">
|
||||
合计:<text class="total-price">¥{{ totalPrice }}</text>
|
||||
<view class="top">
|
||||
<view class="left">
|
||||
<text class="iconfont icon-gouwuche-mendian">
|
||||
<text class="total-num" v-if="totalNum > 0">{{ totalNum > 99 ? '99+' : totalNum }}</text>
|
||||
</text>
|
||||
<view class="total">
|
||||
合计:<text class="total-price">¥{{ totalPrice }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="settlement-btn" @click="settlementCart" v-if="Object.values(buyList).length > 0">立即结算</view>
|
||||
<view class="settlement-btn not-btn" v-else>立即结算</view>
|
||||
</view>
|
||||
<view class="quota-info">
|
||||
<view class="available-line">可用冠名品牌额度:{{ title_surplus_quota || 0 }}</view>
|
||||
<view class="available-line">可用其他品牌额度:{{ other_surplus_quota || 0 }}</view>
|
||||
</view>
|
||||
<view class="settlement-btn" @click="settlementCart" v-if="Object.values(buyList).length > 0">立即结算</view>
|
||||
<view class="settlement-btn not-btn" v-else>立即结算</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 授权登录 -->
|
||||
|
|
@ -138,8 +148,8 @@
|
|||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
import authorize from '@/components/Authorize';
|
||||
import {supplierGoodsList, withGoodsCartAdd} from "@/api/supplier";
|
||||
import {withGoodsCartDel, withGoodsCartIds, withGoodsCartList} from "@/api/supplier";
|
||||
import {supplierGoodsList, withGoodsCartAdd, withGoodsCartDel, withGoodsCartIds, withGoodsCartList} from "@/api/supplier";
|
||||
import {merchantQuotaInfo} from "@/api/store";
|
||||
|
||||
export default {
|
||||
name: 'business',
|
||||
|
|
@ -175,7 +185,11 @@ export default {
|
|||
totalPrice: 0.00,
|
||||
buyList: {},
|
||||
batch_list: {},
|
||||
currentGoods: {}
|
||||
currentGoods: {},
|
||||
// 额度信息
|
||||
quotaInfo: {},
|
||||
title_surplus_quota: 0,
|
||||
other_surplus_quota: 0,
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
|
|
@ -251,11 +265,29 @@ export default {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
// 获取商户额度信息
|
||||
this.getMerchantQuotaInfo();
|
||||
// 商户已经登录 进行后续操作
|
||||
this.getGoodsList();
|
||||
// 获取购物车列表
|
||||
this.cartGetList();
|
||||
},
|
||||
// 获取当前商户补货额度信息
|
||||
getMerchantQuotaInfo(){
|
||||
let _this = this;
|
||||
// 数据查询
|
||||
merchantQuotaInfo(_this.shopMerId).then(res => {
|
||||
if(Number(res.status) === 200){
|
||||
_this.quotaInfo = res.data || {};
|
||||
_this.$set(this, 'title_surplus_quota', _this.quotaInfo.title_surplus_quota || 0);
|
||||
_this.$set(this, 'other_surplus_quota', _this.quotaInfo.other_surplus_quota || 0);
|
||||
}else {
|
||||
console.log("错误", res)
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$util.Tips({title: err});
|
||||
});
|
||||
},
|
||||
// 供应商商品列表
|
||||
getGoodsList(page = 0) {
|
||||
let _this = this;
|
||||
|
|
@ -366,6 +398,7 @@ export default {
|
|||
if(isBatch == 1) stock = Math.floor(stock / (this.currentGoods.batch_num || ''));//批量购买时 库存需要除以每批数量
|
||||
if(Number(stock) < Number(spec.cart_num)) spec.cart_num = stock;
|
||||
// 初始化
|
||||
console.log('当前商品', this.currentGoods)
|
||||
this.$set(this.buyList, spec.product_id, {
|
||||
// 购买单位类型
|
||||
is_batch: this.currentGoods.is_batch,// 是否支持按照批次购买
|
||||
|
|
@ -375,6 +408,7 @@ export default {
|
|||
product_id: spec.product_id,
|
||||
total_num: spec.cart_num,
|
||||
store_name: this.currentGoods.store_name,
|
||||
brand_name: this.currentGoods.brand_name || '',
|
||||
specs: {
|
||||
[spec.unique]: spec,
|
||||
},
|
||||
|
|
@ -437,15 +471,24 @@ export default {
|
|||
},
|
||||
// 购买流程 - 计算总价值和总数量
|
||||
BuyFlowComputeTotal(){
|
||||
let totalNum = 0;
|
||||
let totalPrice = 0.00;
|
||||
let totalNum = 0;// 总数量
|
||||
let totalPrice = 0.00;// 总价值
|
||||
let needTitleQuota = 0;// 需要的冠名品牌额度
|
||||
let needOtherQuota = 0;// 需要的其他品牌额度
|
||||
let merBrandName = this.quotaInfo.mer_brand_name || '';
|
||||
// 循环处理
|
||||
Object.values(this.buyList).forEach(item => {
|
||||
totalNum += item.total_num;
|
||||
let brandName = item.brand_name || '';
|
||||
// 循环处理规格
|
||||
Object.values(item.specs).forEach(value => {
|
||||
let price = value.price * value.cart_num;
|
||||
let currentBatchType = this.batch_list[value.product_id] || 0;
|
||||
// 判断:如果是批量购买 当前价格需要乘以每批的数量
|
||||
if(currentBatchType == 1) price = price * item.batch_num;
|
||||
// 根据品牌类型 获取需要使用的对应的品牌额度
|
||||
if(merBrandName.length > 0 && merBrandName === brandName) needTitleQuota += price;
|
||||
else needOtherQuota += price;
|
||||
|
||||
totalPrice += price;
|
||||
})
|
||||
|
|
@ -453,6 +496,18 @@ export default {
|
|||
// 赋值
|
||||
this.totalNum = totalNum.toFixed(0);
|
||||
this.totalPrice = totalPrice.toFixed(2);
|
||||
// 计算剩余可用冠名品牌额度
|
||||
let titleSurplusQuota = this.quotaInfo.title_surplus_quota || 0;
|
||||
titleSurplusQuota = (Number(titleSurplusQuota) - Number(needTitleQuota)).toFixed(2);
|
||||
titleSurplusQuota = titleSurplusQuota < 0 ? 0 : titleSurplusQuota;
|
||||
this.$set(this, 'title_surplus_quota', titleSurplusQuota);
|
||||
// 计算剩余其他品牌可用额度
|
||||
let otherSurplusQuota = this.quotaInfo.other_surplus_quota || 0;
|
||||
otherSurplusQuota = (Number(otherSurplusQuota) - Number(needOtherQuota)).toFixed(2);
|
||||
otherSurplusQuota = otherSurplusQuota < 0 ? 0 : otherSurplusQuota;
|
||||
this.$set(this, 'other_surplus_quota', otherSurplusQuota);
|
||||
|
||||
this.$forceUpdate();
|
||||
},
|
||||
// 购物车 - 获取已存在列表
|
||||
cartGetList(){
|
||||
|
|
@ -464,6 +519,7 @@ export default {
|
|||
let buyList = {};
|
||||
let batchList = {};
|
||||
Object.values(data).forEach( item => {
|
||||
let productInfo = item.product || {};
|
||||
// 获取规格信息
|
||||
let spec = item.productAttr || {};
|
||||
spec.cart_num = item.cart_num || 0;
|
||||
|
|
@ -485,6 +541,7 @@ export default {
|
|||
product_id: item.product_id,
|
||||
total_num: item.cart_num,
|
||||
store_name: item.product.store_name,
|
||||
brand_name: productInfo.brand_name || '',
|
||||
specs: {
|
||||
[item.product_attr_unique]: spec,
|
||||
},
|
||||
|
|
@ -670,7 +727,7 @@ export default {
|
|||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-evenly;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
.title{
|
||||
width: 100%;
|
||||
|
|
@ -680,6 +737,25 @@ export default {
|
|||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.brand{
|
||||
width: 100%;
|
||||
display: inline-flex;
|
||||
font-size: 28rpx;
|
||||
.brand-box{
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
padding: 0 10rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
.title-brand{
|
||||
background: #8e1318;
|
||||
color: #ffffff;
|
||||
}
|
||||
.other-brand{
|
||||
background: #409eff;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
.price{
|
||||
font-size: 26rpx;
|
||||
color: #d84b40;
|
||||
|
|
@ -770,59 +846,77 @@ export default {
|
|||
background: #FFFFFF;
|
||||
padding: 20rpx 20rpx 50rpx 20rpx;
|
||||
box-shadow: 0 0 10px 0 #f3f3f3;
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.left{
|
||||
z-index: 9;
|
||||
.top{
|
||||
width: 100%;
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.icon-gouwuche-mendian{
|
||||
font-size: 30rpx;
|
||||
margin-right: 20rpx;
|
||||
border: 2rpx solid #000000;
|
||||
border-radius: 50%;
|
||||
padding: 15rpx;
|
||||
position: relative;
|
||||
.total-num{
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
right: -5px;
|
||||
font-size: 20rpx;
|
||||
background: #ef2c1c;
|
||||
color: #ffffff;
|
||||
.left{
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
.icon-gouwuche-mendian{
|
||||
font-size: 30rpx;
|
||||
margin-right: 20rpx;
|
||||
border: 2rpx solid #000000;
|
||||
border-radius: 50%;
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
text-align: center;
|
||||
line-height: 35rpx;
|
||||
padding: 15rpx;
|
||||
position: relative;
|
||||
.total-num{
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
right: -5px;
|
||||
font-size: 20rpx;
|
||||
background: #ef2c1c;
|
||||
color: #ffffff;
|
||||
border-radius: 50%;
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
text-align: center;
|
||||
line-height: 35rpx;
|
||||
}
|
||||
}
|
||||
.total{
|
||||
font-size: 30rpx;
|
||||
.total-price{
|
||||
font-weight: bold;
|
||||
color: #ef2c1c;
|
||||
}
|
||||
}
|
||||
}
|
||||
.total{
|
||||
font-size: 30rpx;
|
||||
.total-price{
|
||||
font-weight: bold;
|
||||
color: #ef2c1c;
|
||||
}
|
||||
.settlement-btn{
|
||||
background: #ef2c1c;
|
||||
color: #FFFFFF;
|
||||
height: 55rpx;
|
||||
line-height: 55rpx;
|
||||
width: 200rpx;
|
||||
text-align: center;
|
||||
border-radius: 100rpx;
|
||||
}
|
||||
.not-btn{
|
||||
background-color: #909399!important;
|
||||
border-color: #909399!important;
|
||||
color: #fff!important;
|
||||
}
|
||||
}
|
||||
.settlement-btn{
|
||||
background: #ef2c1c;
|
||||
color: #FFFFFF;
|
||||
height: 55rpx;
|
||||
line-height: 55rpx;
|
||||
width: 200rpx;
|
||||
text-align: center;
|
||||
border-radius: 100rpx;
|
||||
}
|
||||
.not-btn{
|
||||
background-color: #909399!important;
|
||||
border-color: #909399!important;
|
||||
color: #fff!important;
|
||||
.quota-info{
|
||||
width: 100%;
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.available-line{
|
||||
font-size: 24rpx;
|
||||
color: #828282;
|
||||
height: 40rpx;
|
||||
line-height: 50rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -422,11 +422,14 @@
|
|||
<view>随机立减:</view>
|
||||
<view class='money'>-¥{{orderTotalRandomReduction}}</view>
|
||||
</view>
|
||||
<view class='item acea-row row-between-wrapper' v-if="orderTotalMerQuota > 0">
|
||||
<view>补货额度减免:</view>
|
||||
<view class='money'>-¥{{orderTotalMerQuota}}</view>
|
||||
<view class='item acea-row row-between-wrapper' v-if="orderTotalMerTitleQuota > 0">
|
||||
<view>冠名品牌补货额度减免:</view>
|
||||
<view class='money'>-¥{{orderTotalMerTitleQuota}}</view>
|
||||
</view>
|
||||
<view class='item acea-row row-between-wrapper' v-if="orderTotalMerOtherQuota > 0">
|
||||
<view>其他品牌补货额度减免:</view>
|
||||
<view class='money'>-¥{{orderTotalMerOtherQuota}}</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!--<view class='item acea-row row-between-wrapper' v-if="!seckillId && order_type != 3 && order_type != 4 && enabledPlatformCoupon">
|
||||
<view>平台优惠券<text @tap="showCoupon" class="iconfont icon-wenhao1"></text></view>
|
||||
|
|
@ -696,7 +699,9 @@
|
|||
points: {},
|
||||
// 随机立减金额(总)
|
||||
orderTotalRandomReduction: 0,
|
||||
orderTotalMerQuota: 0,
|
||||
// 补货额度抵扣金额
|
||||
orderTotalMerTitleQuota: 0,
|
||||
orderTotalMerOtherQuota: 0,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -1124,7 +1129,9 @@
|
|||
that.$set(that, 'orderTotalWineDiffMoneyPrice', res.data.orderTotalWineDiffMoneyPrice);
|
||||
|
||||
that.$set(that, 'orderTotalRandomReduction', res.data.orderTotalRandomReduction);
|
||||
that.$set(that, 'orderTotalMerQuota', res.data.orderTotalMerQuota);
|
||||
that.$set(that, 'orderTotalMerTitleQuota', res.data.orderTotalMerTitleQuota);
|
||||
that.$set(that, 'orderTotalMerOtherQuota', res.data.orderTotalMerOtherQuota);
|
||||
|
||||
|
||||
that.$set(that, 'open_integral', res.data.openIntegral);
|
||||
that.$set(that, 'use_integral', res.data.useIntegral);
|
||||
|
|
|
|||
Loading…
Reference in New Issue