切换公司逻辑完善
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<view class='user-info-view'>
|
||||
<image
|
||||
class='image-bg'
|
||||
:src=" assetsUrl('test_bg.png')"
|
||||
:src='companyConfigInfo.userbgcover'
|
||||
/>
|
||||
|
||||
<view class='top-row'>
|
||||
@@ -18,15 +18,15 @@
|
||||
|
||||
<view class='bottom-row'>
|
||||
<view @click.stop='gotoPath("/pages/mine/subs/integral/index")'>
|
||||
<text>{{ userInfo?.integration||0 }}</text>
|
||||
<text>{{ userInfo?.integration || 0 }}</text>
|
||||
<text>积分</text>
|
||||
</view>
|
||||
<view @click.stop='gotoPath("/pages/mine/subs/recharge/index")'>
|
||||
<text>{{ userInfo?.balance||0 }}</text>
|
||||
<text>{{ userInfo?.balance || 0 }}</text>
|
||||
<text>余额</text>
|
||||
</view>
|
||||
<view @click.stop='gotoPath("/pages/mine/subs/coupon/index")'>
|
||||
<text>{{ userInfo?.couponsCount || 0}}</text>
|
||||
<text>{{ userInfo?.couponsCount || 0 }}</text>
|
||||
<text>优惠券</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -122,7 +122,7 @@ const title = ref<string>();
|
||||
title.value = import.meta.env.VITE_APP_TITLE;
|
||||
|
||||
const store = useUserStore();
|
||||
const { userInfo } = storeToRefs(store);
|
||||
const { userInfo, companyConfigInfo } = storeToRefs(store);
|
||||
|
||||
onLoad(() => {
|
||||
if(!isLogin()) {
|
||||
|
@@ -10,7 +10,7 @@
|
||||
<text class='secondary-text-color' style='flex: 1'>{{ item?.createtime }}</text>
|
||||
<text style='color: #999999'>会员积分:¥30.00</text>
|
||||
</view>
|
||||
<view class='divider' style='margin-top: 20rpx'/>
|
||||
<!-- <view class='divider' style='margin-top: 20rpx'/>-->
|
||||
<!-- </view>-->
|
||||
</view>
|
||||
</template>
|
||||
@@ -28,7 +28,7 @@ defineProps({
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 16rpx 23rpx 20rpx 30rpx;
|
||||
margin: 20rpx 0;
|
||||
margin: 10rpx 0;
|
||||
}
|
||||
|
||||
.category-title {
|
||||
|
@@ -1,12 +1,14 @@
|
||||
<template>
|
||||
<view class='content'>
|
||||
<view class='top-view c-flex-column'>
|
||||
<text>{{ userInfo.integration }}</text>
|
||||
<text>{{ userInfo?.integration }}</text>
|
||||
<text>会员积分</text>
|
||||
</view>
|
||||
<text class='integral-detail-title'>积分明细</text>
|
||||
<scroll-view style='margin: 10rpx 20rpx'>
|
||||
<integral-item v-for='(item,index) in tradeList' :key='index' :item='item' />
|
||||
<u-list @scrolltolower='loadMore'>
|
||||
<integral-item v-for='(item,index) in tradeList' :key='index' :item='item' />
|
||||
</u-list>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -19,16 +21,26 @@ import { useUserStore } from '@/store';
|
||||
const userStore = useUserStore();
|
||||
const { userInfo } = storeToRefs(userStore);
|
||||
const tradeList = ref([]);
|
||||
const currentPageNum = ref(1);
|
||||
|
||||
onLoad((e) => {
|
||||
fetchData();
|
||||
});
|
||||
|
||||
const fetchData = async () => {
|
||||
const fetchData = async (refresh: boolean = true) => {
|
||||
currentPageNum.value = refresh ? 1 : currentPageNum.value + 1;
|
||||
const { rows } = await getIntegralList({
|
||||
fbean: { 'pageNum': 1, 'pageSize': 10, 'bean': {} }
|
||||
fbean: { 'pageNum': currentPageNum.value, 'pageSize': 20, 'bean': {} }
|
||||
});
|
||||
tradeList.value = rows;
|
||||
if(refresh) {
|
||||
tradeList.value = rows;
|
||||
} else {
|
||||
tradeList.value = tradeList.value.concat(rows);
|
||||
}
|
||||
};
|
||||
|
||||
const loadMore = () => {
|
||||
fetchData(false);
|
||||
};
|
||||
|
||||
</script>
|
||||
|
@@ -5,7 +5,9 @@
|
||||
<view class='c-flex-column' style='flex: 1;'>
|
||||
<view class='c-flex-row'>
|
||||
<text class='goods-name'>{{ item?.orderGoods[0].goodsName }}</text>
|
||||
<text class='status'>未支付</text>
|
||||
<text class='status'>
|
||||
{{ item?.payStatus == 2 ? '已支付' : '未支付' }}
|
||||
</text>
|
||||
</view>
|
||||
<view class='bottom-view c-flex-row'>
|
||||
<text>
|
||||
@@ -19,30 +21,43 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class='action-view c-flex-row'>
|
||||
<view class='countdown c-flex-row'>
|
||||
<view class='countdown c-flex-row' v-if='item?.payStatus==1'>
|
||||
<image :src='assetsUrl("ic_time.png")' />
|
||||
<text class='primary-text-color'>支付剩余时间
|
||||
<text class='accent-text-color'>05:23</text>
|
||||
</text>
|
||||
</view>
|
||||
<view v-else style='flex: 1' />
|
||||
|
||||
<view class='c-flex-row'>
|
||||
<text class='secondary-text-color'>加入购物车</text>
|
||||
<text class='accent-text-color'>立即支付</text>
|
||||
<text class='add-shoppingcart secondary-text-color' @click.stop='add(item?.orderGoods[0])'>加入购物车</text>
|
||||
<text class='payment accent-text-color' v-if='item?.payStatus==1' @click.stop='pay(item?.id)'>立即支付
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang='ts' setup>
|
||||
import { PropType } from 'vue';
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import { goPath } from '@/utils';
|
||||
import { PropType } from 'vue';
|
||||
import { OrderBean } from '@/api/order/types';
|
||||
import { GoodsBean } from '@/api/goods/types';
|
||||
|
||||
const emits = defineEmits(['addShoppingCart', 'payment']);
|
||||
|
||||
defineProps({
|
||||
item: Object as PropType<OrderBean>
|
||||
});
|
||||
|
||||
const add = (item: GoodsBean | undefined) => {
|
||||
emits('addShoppingCart', item);
|
||||
};
|
||||
|
||||
const pay = (orderId: string) => {
|
||||
emits('payment', orderId);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
@@ -135,11 +150,12 @@ defineProps({
|
||||
border-radius: 34rpx;
|
||||
}
|
||||
|
||||
text:nth-of-type(1) {
|
||||
.add-shoppingcart {
|
||||
border: 1rpx solid #ACACAC;
|
||||
}
|
||||
|
||||
text:nth-of-type(2) {
|
||||
|
||||
.payment {
|
||||
border: 1rpx solid #F32B2B;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<scroll-view scroll-y>
|
||||
<view class='content'>
|
||||
<view class='countdown c-flex-row'>
|
||||
<view class='countdown c-flex-row' v-if='orderBean?.order.payStatus==1'>
|
||||
<image :src='assetsUrl("ic_order.png")' />
|
||||
<view class='c-flex-column'>
|
||||
<text>
|
||||
@@ -66,13 +66,13 @@
|
||||
</view>
|
||||
<view class='c-flex-row'>
|
||||
<text class='card-view-title'>运费</text>
|
||||
<text class='card-view-value'>¥8</text>
|
||||
<text class='card-view-value'>¥0</text>
|
||||
</view>
|
||||
<view class='c-flex-row'>
|
||||
<text class='card-view-title'>优惠券
|
||||
<text style='font-size: 22rpx;color: #F32B2B;'>已选最大优惠</text>
|
||||
</text>
|
||||
<text class='card-view-value' style='color: #F32B2B;margin: 0'>-¥{{orderBean?.order?.reducePrice}}
|
||||
<text class='card-view-value' style='color: #F32B2B;margin: 0'>-¥{{ orderBean?.order?.reducePrice }}
|
||||
</text>
|
||||
</view>
|
||||
<view class='divider' />
|
||||
@@ -93,9 +93,19 @@
|
||||
<text>下单时间:{{ orderBean?.order?.createTime }}</text>
|
||||
</view>
|
||||
|
||||
<view class='bottom-action-view c-flex-row'>
|
||||
<view class='bottom-action-view c-flex-row' v-if='orderBean?.order.payStatus==1'>
|
||||
<text @click.stop='cancel'>取消订单</text>
|
||||
<text @click.stop='payment'>立即支付</text>
|
||||
<sqb-pay @bindnavigateTo='navigateTo'
|
||||
:return_url='buildSqbParams.return_url'
|
||||
:total_amount='buildSqbParams.total_amount'
|
||||
:terminal_sn='buildSqbParams.terminal_sn'
|
||||
:client_sn='buildSqbParams.client_sn'
|
||||
:subject='buildSqbParams.subject'
|
||||
:merchant_name='buildSqbParams.merchant_name'
|
||||
:notify_url='buildSqbParams.notify_url'
|
||||
:sign='buildSqbParams.sign'>
|
||||
<button @click='payment'>立即支付</button>
|
||||
</sqb-pay>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -105,6 +115,12 @@
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import { getOrderDetail } from '@/api/order';
|
||||
import { OrderBean } from '@/api/order/types';
|
||||
import { parseParameter, sortASCII } from '@/utils';
|
||||
import { hexMD5 } from '@/utils/common/md5';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
const userState = useUserStore();
|
||||
const { terminalInfo } = storeToRefs(userState);
|
||||
|
||||
const orderBean = ref<{
|
||||
order: OrderBean,
|
||||
@@ -113,13 +129,43 @@ const orderBean = ref<{
|
||||
}>();
|
||||
|
||||
onLoad(async (e: any) => {
|
||||
await uni.showLoading();
|
||||
orderBean.value = await getOrderDetail(e.orderId);
|
||||
uni.hideLoading();
|
||||
});
|
||||
|
||||
const buildSqbParams = computed(() => {
|
||||
const params = sortASCII({
|
||||
client_sn: orderBean.value?.order?.id || '',
|
||||
return_url: '/pages/common/payresult/index',
|
||||
total_amount: ((orderBean.value?.order?.totalPrice || 0) * 100).toString(),
|
||||
terminal_sn: terminalInfo.value.terminalSn,
|
||||
subject: '商品支付',
|
||||
merchant_name: terminalInfo.value.companyName,
|
||||
notify_url: 'https://www.baidu.com'
|
||||
}, true);
|
||||
return {
|
||||
...params,
|
||||
sign: hexMD5(parseParameter(params) + '&key=' + terminalInfo.value.terminalKey).toUpperCase()
|
||||
};
|
||||
});
|
||||
|
||||
const navigateTo = (e: any) => {
|
||||
console.log('--------------_>>>>>>navigateTo ', e);
|
||||
uni.redirectTo({
|
||||
url: e.detail.url,
|
||||
fail(e) {
|
||||
uni.showToast({
|
||||
title: '支付失败'
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const cancel = () => {
|
||||
};
|
||||
const payment = () => {
|
||||
|
||||
console.log(buildSqbParams.value);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -334,6 +380,7 @@ const payment = () => {
|
||||
.bottom-action-view {
|
||||
background: #FFFFFF;
|
||||
position: fixed;
|
||||
height: 80rpx;
|
||||
justify-content: flex-end;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
@@ -350,11 +397,12 @@ const payment = () => {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
text:nth-of-type(2) {
|
||||
padding: 17rpx 45rpx;
|
||||
sqb-pay button {
|
||||
padding: 0 45rpx;
|
||||
border-radius: 50rpx;
|
||||
border: 1rpx solid #F32B2B;
|
||||
font-weight: bold;
|
||||
background: #FFFFFF;
|
||||
font-size: 30rpx;
|
||||
color: #F32B2B;
|
||||
}
|
||||
|
@@ -2,18 +2,28 @@
|
||||
<tabbar :titles="['全部', '进行中', '已结束']" @change='tabChange' />
|
||||
<u-list :list='orderList' :border='false' @scrolltolower='loadMore'>
|
||||
<u-list-item v-for='(item,index) in orderList' :key='index'>
|
||||
<order-item :item='item' />
|
||||
<order-item :item='item' @addShoppingCart='addShoppingCart' @pay='payment' />
|
||||
</u-list-item>
|
||||
<u-loadmore status='loading' />
|
||||
</u-list>
|
||||
<sku-dialog ref='skuDialogRef' :exists='temporaryStockBean' />
|
||||
|
||||
</template>
|
||||
|
||||
<script lang='ts' setup>
|
||||
|
||||
import { ref } from 'vue';
|
||||
import { getOrderList } from '@/api/order';
|
||||
import OrderItem from '@/pages/mine/subs/order/components/order-item.vue';
|
||||
import { OrderBean } from '@/api/order/types';
|
||||
import SkuDialog from '@/components/sku-dialog.vue';
|
||||
import { GoodsBean, StockBean } from '@/api/goods/types';
|
||||
import { showToast } from '@/utils';
|
||||
import useShoppingCartStore from '@/store/modules/shoppingcart';
|
||||
|
||||
const shoppingCartStore = useShoppingCartStore();
|
||||
const skuDialogRef = ref();
|
||||
const temporaryStockBean = ref<StockBean>();
|
||||
const orderList = ref<OrderBean[]>([]);
|
||||
const currentPageNum = ref(1);
|
||||
const payStatus = ref(0);
|
||||
@@ -46,6 +56,17 @@ const fetchData = async (refresh: boolean = true) => {
|
||||
const loadMore = () => {
|
||||
fetchData(false);
|
||||
};
|
||||
|
||||
const addShoppingCart = (item: GoodsBean) => {
|
||||
skuDialogRef.value.show(item.goodsId, (e: GoodsBean) => {
|
||||
shoppingCartStore.save(e);
|
||||
showToast('加入购物车成功');
|
||||
});
|
||||
};
|
||||
|
||||
const payment = (orderId: string) => {
|
||||
console.log(orderId);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class='content'>
|
||||
<view class='top-card-view'>
|
||||
<image class='bg-image' :src='assetsUrl("test_bg.png")' />
|
||||
<image class='bg-image' :src='companyConfigInfo.userbgcover' />
|
||||
<image class='avatar-image' :src='params.avatarUrl' />
|
||||
<text>{{ userInfo.name }}</text>
|
||||
<text>{{ userInfo.levelName }}</text>
|
||||
@@ -61,7 +61,7 @@ import { useUserStore } from '@/store';
|
||||
import { showToast } from '@/utils';
|
||||
|
||||
const store = useUserStore();
|
||||
const { userInfo } = storeToRefs(store);
|
||||
const { userInfo,companyConfigInfo } = storeToRefs(store);
|
||||
|
||||
const params = ref<{
|
||||
avatarUrl: string;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
</view>
|
||||
<view class='balance-content'>
|
||||
<text>当前余额(元)</text>
|
||||
<text class='accent-text-color'>¥{{ userInfo.balance }}</text>
|
||||
<text class='accent-text-color'>¥{{ userInfo?.balance }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -27,7 +27,19 @@
|
||||
</view>
|
||||
|
||||
<view class='bottom-button-view'>
|
||||
<button class='primary-button' @click.stop='goRecharge'>充值</button>
|
||||
<!-- <payment-button style='flex: 1' :payParams='buildSignParams'>-->
|
||||
<sqb-pay style='width: 100%;' @bindnavigateTo='navigateTo'
|
||||
:return_url='buildSqbParams.return_url'
|
||||
:total_amount='buildSqbParams.total_amount'
|
||||
:terminal_sn='buildSqbParams.terminal_sn'
|
||||
:client_sn='buildSqbParams.client_sn'
|
||||
:subject='buildSqbParams.subject'
|
||||
:merchant_name='buildSqbParams.merchant_name'
|
||||
:notify_url='buildSqbParams.notify_url'
|
||||
:sign='buildSqbParams.sign'>
|
||||
<button class='primary-button' @click='goRecharge'>充值</button>
|
||||
</sqb-pay>
|
||||
<!-- </payment-button>-->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -36,9 +48,11 @@
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import { useUserStore } from '@/store';
|
||||
import { getRechargeList, recharge } from '@/api/user';
|
||||
import { parseParameter, sortASCII } from '@/utils';
|
||||
import { hexMD5 } from '@/utils/common/md5';
|
||||
|
||||
const store = useUserStore();
|
||||
const { userInfo } = storeToRefs(store);
|
||||
const userState = useUserStore();
|
||||
const { userInfo, terminalInfo } = storeToRefs(userState);
|
||||
|
||||
const rechargeItems = ref<{
|
||||
itemid: string
|
||||
@@ -52,13 +66,44 @@ const currentIndex = ref<number>(0);
|
||||
onLoad(async () => {
|
||||
const { ruleitems } = await getRechargeList();
|
||||
rechargeItems.value = ruleitems;
|
||||
change(0);
|
||||
});
|
||||
|
||||
const change = (index: number) => {
|
||||
currentIndex.value = index;
|
||||
};
|
||||
|
||||
const buildSqbParams = computed(() => {
|
||||
const params = sortASCII({
|
||||
// client_sn: rechargeItems.value[currentIndex.value]?.itemid || '',
|
||||
client_sn: Date.now().toString(),
|
||||
return_url: '/pages/common/payresult/index',
|
||||
total_amount: ((rechargeItems.value[currentIndex.value]?.rechargeamount || 0) * 100).toString(),
|
||||
terminal_sn: terminalInfo.value.terminalSn,
|
||||
subject: '充值',
|
||||
merchant_name: terminalInfo.value.companyName,
|
||||
notify_url: 'https://www.baidu.com'
|
||||
}, true);
|
||||
return {
|
||||
...params,
|
||||
sign: hexMD5(parseParameter(params) + '&key=' + terminalInfo.value.terminalKey).toUpperCase()
|
||||
};
|
||||
});
|
||||
|
||||
const navigateTo = (e: any) => {
|
||||
console.log('--------------_>>>>>>navigateTo ', e);
|
||||
uni.redirectTo({
|
||||
url: e.detail.url,
|
||||
fail(e) {
|
||||
uni.showToast({
|
||||
title: '支付失败'
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const goRecharge = () => {
|
||||
console.log(buildSqbParams.value);
|
||||
recharge({
|
||||
itemid: rechargeItems.value[currentIndex.value].itemid
|
||||
});
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<tabbar :titles='["全部","充值","消费"]' :item-active-color='"#D95554"' :indicator-color='"#D95554"' />
|
||||
<tabbar :titles='["全部","充值","消费"]' @change='changeTab' :item-active-color='"#D95554"'
|
||||
:indicator-color='"#D95554"' />
|
||||
<view class='content'>
|
||||
<view class='c-flex-row'>
|
||||
<text>选择日期</text>
|
||||
@@ -11,20 +12,33 @@
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<scroll-view :scroll-y='true'>
|
||||
<u-list @scrolltolower='loadMore'>
|
||||
<trade-item v-for='(item,index) in tradeList' :key='index' :item='item' />
|
||||
</scroll-view>
|
||||
</u-list>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang='ts' setup>
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import TradeItem from '@/pages/mine/subs/trade/components/trade-item.vue';
|
||||
import TradeItem from './components/trade-item.vue';
|
||||
|
||||
const tradeList = ref([1, 2, 3, 4, 5]);
|
||||
const currentPageNum = ref(1);
|
||||
|
||||
const changeDate = () => {
|
||||
fetchData();
|
||||
};
|
||||
|
||||
const changeTab = (index: number) => {
|
||||
fetchData();
|
||||
};
|
||||
|
||||
const fetchData = (refresh: boolean = true) => {
|
||||
currentPageNum.value = refresh ? 1 : currentPageNum.value + 1;
|
||||
};
|
||||
|
||||
const loadMore = () => {
|
||||
fetchData(false);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user