功能完善
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class='content' v-if='companyConfigInfo.mallopen==0'>
|
||||
<view class='content' v-if='companyConfigInfo.mallopen==1'>
|
||||
<view class='search-view'>
|
||||
<view class='search-input' @click.stop='goPath("/pages/mall/subs/search/index")'>
|
||||
<image :src=' assetsUrl("ic_search.png")'></image>
|
||||
@@ -50,7 +50,7 @@ import useShoppingCartStore from '@/store/modules/shoppingcart';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { userInfo, companyConfigInfo } = storeToRefs(userStore);
|
||||
const { companyConfigInfo } = storeToRefs(userStore);
|
||||
const shoppingCartStore = useShoppingCartStore();
|
||||
const { shoppingCartList } = storeToRefs(shoppingCartStore);
|
||||
|
||||
@@ -66,6 +66,8 @@ onLoad(() => {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('companyConfigInfo.value', companyConfigInfo.value);
|
||||
|
||||
userStore.$onAction(({ name, after }) => {
|
||||
after(() => {
|
||||
//更新用户信息
|
||||
@@ -79,8 +81,10 @@ onLoad(() => {
|
||||
});
|
||||
|
||||
const fetchCategoryList = async () => {
|
||||
categoryList.value = await getCategoryList();
|
||||
await changeCategory(0);
|
||||
if(companyConfigInfo.value.mallopen == 1) {
|
||||
categoryList.value = await getCategoryList();
|
||||
await changeCategory(0);
|
||||
}
|
||||
};
|
||||
|
||||
const changeCategory = async (index: number) => {
|
||||
|
@@ -7,7 +7,9 @@
|
||||
</view>
|
||||
|
||||
<scroll-view scroll-y>
|
||||
<coupon-item v-for='(item,index) in coupons' :item='item' :key='index' @confirm='confirmItem(index)' />
|
||||
<coupon-item v-if='coupons.length>0' v-for='(item,index) in coupons' :item='item' :key='index'
|
||||
@confirm='confirmItem(index)' />
|
||||
<u-loadmore v-else status='loading' />
|
||||
</scroll-view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
@@ -104,6 +106,7 @@ defineExpose({
|
||||
}
|
||||
|
||||
scroll-view {
|
||||
height: 600rpx;
|
||||
max-height: 600rpx;
|
||||
}
|
||||
|
||||
|
@@ -42,7 +42,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='recommend-view c-flex-column'>
|
||||
<view class='recommend-view c-flex-column' v-if='recommendList?.length>0'>
|
||||
<text>浏览此商品的客户还浏览了</text>
|
||||
<scroll-view scroll-x>
|
||||
<view style='display: inline-block' v-for='(item, index) in recommendList'
|
||||
@@ -113,6 +113,7 @@ const bannerList = ref([]);
|
||||
const swiperIndex = ref(0);
|
||||
|
||||
onLoad(async (e: any) => {
|
||||
await uni.showLoading();
|
||||
goodsBean.value = await getGoodsDetail(e.goodsId);
|
||||
const { rows } = await getGoodsList({
|
||||
page: {
|
||||
@@ -125,6 +126,7 @@ onLoad(async (e: any) => {
|
||||
}
|
||||
});
|
||||
recommendList.value = rows;
|
||||
uni.hideLoading();
|
||||
});
|
||||
|
||||
const getStockColorCount = computed(() => {
|
||||
|
@@ -85,7 +85,7 @@
|
||||
<view style='flex: 1' />
|
||||
<view class='c-flex-row'>
|
||||
<text class='card-view-value'>共1件商品 合计:
|
||||
<text style='font-size: 34rpx;color:#F32B2B'>¥{{ orderBean?.totalPrice || 0 }}</text>
|
||||
<text style='font-size: 34rpx;color:#F32B2B'>¥{{ totalPrice || 0 }}</text>
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
<view class='bottom-view c-flex-row'>
|
||||
<text>合计</text>
|
||||
<text>¥{{ orderBean?.totalPrice || 0 }}</text>
|
||||
<text>¥{{ totalPrice || 0 }}</text>
|
||||
<sqb-pay @navigateTo='navigateTo'
|
||||
:return_url='buildSqbParams.return_url'
|
||||
:total_amount='buildSqbParams.total_amount'
|
||||
@@ -131,9 +131,11 @@ import { CouponBean } from '@/api/user/types';
|
||||
import { OrderBean } from '@/api/order/types';
|
||||
import { useUserStore } from '@/store';
|
||||
import { handlePayResult } from '@/utils/order';
|
||||
import useShoppingCartStore from '@/store/modules/shoppingcart';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { terminalInfo, deliveryAddress } = storeToRefs(userStore);
|
||||
const { userInfo, terminalInfo, deliveryAddress } = storeToRefs(userStore);
|
||||
const shoppingCartStore = useShoppingCartStore();
|
||||
|
||||
const couponDialogRef = ref();
|
||||
const paymentDialogRef = ref();
|
||||
@@ -149,6 +151,10 @@ onLoad((e) => {
|
||||
createOrder();
|
||||
});
|
||||
|
||||
const totalPrice = computed(() => {
|
||||
return (orderBean?.value?.totalPrice || 0) - (checkedCoupon.value?.reduce || 0);
|
||||
});
|
||||
|
||||
const buildSqbParams = computed(() => {
|
||||
const params = sortASCII({
|
||||
client_sn: orderBean.value?.id || '',
|
||||
@@ -177,6 +183,7 @@ const showCouponDialog = () => {
|
||||
|
||||
const confirmCoupon = (item: CouponBean) => {
|
||||
checkedCoupon.value = item;
|
||||
createOrder();
|
||||
};
|
||||
const navigateTo = (e: any) => {
|
||||
handlePayResult(orderBean.value?.id, e, {
|
||||
@@ -195,13 +202,14 @@ const createOrder = async () => {
|
||||
const params = {
|
||||
// 'discount': 0,
|
||||
// 'freePrice': 0,
|
||||
// 'reducePrice': 0,
|
||||
'totalPrice': orderBean?.value?.totalPrice,
|
||||
'reducePrice': checkedCoupon.value == undefined ? 0 : checkedCoupon.value?.reduce,
|
||||
'totalPrice': totalPrice.value,
|
||||
// 'integral': 0,
|
||||
// 'allowIntegral': 0,
|
||||
// 'produceIntegralNumber': 0,
|
||||
'couponIds': checkedCoupon.value?.id,
|
||||
'remark': orderBean.value?.remark,
|
||||
// 'address': JSON.stringify(deliveryAddress.value),
|
||||
'address': tabIndex.value == 0 ? undefined : JSON.stringify(deliveryAddress.value),
|
||||
'orderGoods': orderBean?.value?.orderGoods?.map(item => (
|
||||
{
|
||||
'goodsId': item.id,
|
||||
@@ -209,8 +217,9 @@ const createOrder = async () => {
|
||||
'goodsNum': item.checkedStock.count,
|
||||
'stockId': item.checkedStock.stockId,
|
||||
'originPrice': item.price,
|
||||
'consumePrice': item.price
|
||||
// 'discount': 0,
|
||||
// 'consumePrice': item.price * ((userInfo.value?.levelEntity?.discount || 0) / 100),
|
||||
'consumePrice': item.price,
|
||||
'discount': userInfo.value?.levelEntity?.discount || 0
|
||||
// 'discountOriginPrice': 0,
|
||||
// 'produceIntegral': 0,
|
||||
// 'priceModify': [0],
|
||||
@@ -221,6 +230,15 @@ const createOrder = async () => {
|
||||
const result = await orderCreate(params);
|
||||
orderBean.value!.id = result.id;
|
||||
uni.hideLoading();
|
||||
|
||||
|
||||
//删除购物车已存在商品
|
||||
orderBean?.value?.orderGoods?.forEach(item => {
|
||||
const index = shoppingCartStore.getSameGoodsIndex(item.id, item.checkedStock.colorId, item.checkedStock.sizeId);
|
||||
if(index >= 0) {
|
||||
shoppingCartStore.delete(index);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const payment = async () => {
|
||||
|
Reference in New Issue
Block a user