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