功能完善
This commit is contained in:
@@ -3,7 +3,9 @@ import { get, post } from '@/utils';
|
||||
enum URL {
|
||||
orderCreate = '/sales/wx_order_create',
|
||||
orderList = '/sales/wx_query',
|
||||
orderDetail = '/order/wx_get/'
|
||||
orderDetail = '/order/wx_get/',
|
||||
paymentList = '/sales/payment/',
|
||||
overPayment = '/sales/over_payment'
|
||||
}
|
||||
|
||||
|
||||
@@ -19,3 +21,6 @@ export const getOrderList = (data: {
|
||||
|
||||
export const getOrderDetail = (orderId: string) => get<any>({ url: URL.orderDetail + `${orderId}` });
|
||||
|
||||
export const getPaymentList = (orderId: string) => get<any>({ url: URL.paymentList + `${orderId}` });
|
||||
export const overPayment = (data: any) => post({ url: URL.overPayment, data });
|
||||
|
||||
|
@@ -14,6 +14,7 @@ enum URL {
|
||||
logout = '/user/logout',
|
||||
// profile = '/user/profile',
|
||||
profile = 'wc/wechat/member_detail',
|
||||
updateProfile = '/member/wx_update',
|
||||
|
||||
// wc/wechat/member_detail
|
||||
addressList = '/ext/addr/list',
|
||||
@@ -23,13 +24,19 @@ enum URL {
|
||||
addressDelete = '/ext/addr/delete',
|
||||
dynamicCode = '/member/dynccode',
|
||||
rechargeList = '/ext/recharge/rule_config',
|
||||
preRecharge = '/memberIncoming/wx_incoming_pre',
|
||||
recharge = '/memberIncoming/wx_save',
|
||||
rechargeVerify = '/memberIncoming/wx_paid',
|
||||
couponList = '/wechat/coupons/coupons/pageList',
|
||||
integralList = '/ext/member/integral_query',
|
||||
tradeList = '/memberIncoming/wx_balance_records',
|
||||
terminal = 'wechat/coupons/terminal?companyId='
|
||||
}
|
||||
|
||||
export const getUserProfile = () => get<UserBean>({ url: URL.profile });
|
||||
|
||||
export const updateProfile = (data: any) => post<any>({ url: URL.updateProfile, data });
|
||||
|
||||
export const login = (data: LoginParams) => post<LoginResult>({ url: URL.login, data });
|
||||
export const loginByCode = (code: string, companyId: string) => post<any>({ url: URL.loginByCode + `?code=${code}` });
|
||||
|
||||
@@ -48,10 +55,15 @@ export const getDynamicCode = () => post<any>({ url: URL.dynamicCode });
|
||||
|
||||
export const getRechargeList = () => get<any>({ url: URL.rechargeList });
|
||||
|
||||
export const preRecharge = (data: any) => post({ url: URL.preRecharge, data });
|
||||
|
||||
export const recharge = (data: any) => post({ url: URL.recharge, data });
|
||||
export const rechargeVerify = (data: any) => post({ url: URL.rechargeVerify, data });
|
||||
|
||||
export const getCouponList = (data: any) => post<CouponBean[]>({ url: URL.couponList, data });
|
||||
|
||||
export const getIntegralList = (data: any) => get({ url: URL.integralList, data });
|
||||
|
||||
export const getTerminal = (companyId: string) => get<TerminalBean>({ url: URL.terminal + companyId });
|
||||
|
||||
export const getTradeList = (data: any) => post<any>({ url: URL.tradeList, data });
|
||||
|
@@ -17,7 +17,7 @@ export interface RegisterParams {
|
||||
birthday: string,
|
||||
companyId: string,
|
||||
creatorId: string,
|
||||
gender: number
|
||||
gender: string
|
||||
}
|
||||
|
||||
export interface LoginByCodeParams {
|
||||
|
@@ -14,17 +14,24 @@
|
||||
|
||||
<view v-show='tabIndex==1' class='address-view c-flex-column'
|
||||
@click.stop='goPath("/pages/mine/subs/address/index")'>
|
||||
<view class='user-info c-flex-row'>
|
||||
<text>默认</text>
|
||||
<text>黄先生</text>
|
||||
<text>155****6532</text>
|
||||
<view style='flex: 1' />
|
||||
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
|
||||
</view>
|
||||
|
||||
<view class='addr c-flex-row'>
|
||||
<image :src='assetsUrl("ic_location.png")' />
|
||||
<text>湖南省 长沙市 详细地址详细地址详细地址</text>
|
||||
<view v-if='deliveryAddress?.addrid'>
|
||||
<view class='user-info c-flex-row'>
|
||||
<text class='status' v-if='deliveryAddress?.defaultstatus==1'>默认</text>
|
||||
<text>{{ deliveryAddress?.name }}</text>
|
||||
<text>{{ deliveryAddress?.mobile }}</text>
|
||||
<view style='flex: 1' />
|
||||
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
|
||||
</view>
|
||||
|
||||
<view class='addr c-flex-row'>
|
||||
<image :src='assetsUrl("ic_location.png")' />
|
||||
<text>{{ deliveryAddress?.addr }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class='user-info c-flex-row'>
|
||||
<text style='flex: 1'>请选择收货地址</text>
|
||||
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
|
||||
</view>
|
||||
<image class='dashed-line' :src='assetsUrl("ic_address_dashed_line.png")' />
|
||||
</view>
|
||||
@@ -119,13 +126,13 @@ import PaymentDialog from '@/components/payment-dialog.vue';
|
||||
import CouponDialog from '@/pages/mall/subs/components/coupon-dialog.vue';
|
||||
import { goPath, parseParameter, sortASCII } from '@/utils';
|
||||
import { hexMD5 } from '@/utils/common/md5';
|
||||
import { orderCreate } from '@/api/order';
|
||||
import { getPaymentList, orderCreate, overPayment } from '@/api/order';
|
||||
import { CouponBean } from '@/api/user/types';
|
||||
import { OrderBean } from '@/api/order/types';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { terminalInfo } = storeToRefs(userStore);
|
||||
const { terminalInfo, deliveryAddress } = storeToRefs(userStore);
|
||||
|
||||
const couponDialogRef = ref();
|
||||
const paymentDialogRef = ref();
|
||||
@@ -159,7 +166,7 @@ const buildSqbParams = computed(() => {
|
||||
});
|
||||
|
||||
const changePayment = () => {
|
||||
paymentDialogRef.value.show();
|
||||
// paymentDialogRef.value.show();
|
||||
};
|
||||
|
||||
const showCouponDialog = () => {
|
||||
@@ -185,14 +192,15 @@ const navigateTo = (e: any) => {
|
||||
const payment = async () => {
|
||||
await uni.showLoading();
|
||||
const params = {
|
||||
'discount': 0,
|
||||
'freePrice': 0,
|
||||
'reducePrice': 0,
|
||||
// 'discount': 0,
|
||||
// 'freePrice': 0,
|
||||
// 'reducePrice': 0,
|
||||
'totalPrice': orderBean?.value?.totalPrice,
|
||||
'integral': 0,
|
||||
'allowIntegral': 0,
|
||||
'produceIntegralNumber': 0,
|
||||
// 'integral': 0,
|
||||
// 'allowIntegral': 0,
|
||||
// 'produceIntegralNumber': 0,
|
||||
'remark': orderBean.value?.remark,
|
||||
// 'address': JSON.stringify(deliveryAddress.value),
|
||||
'orderGoods': orderBean?.value?.orderGoods?.map(item => (
|
||||
{
|
||||
'goodsId': item.id,
|
||||
@@ -200,12 +208,12 @@ const payment = async () => {
|
||||
'goodsNum': item.checkedStock.count,
|
||||
'stockId': item.checkedStock.stockId,
|
||||
'originPrice': item.price,
|
||||
'consumePrice': item.price,
|
||||
'discount': 0,
|
||||
'discountOriginPrice': 0,
|
||||
'produceIntegral': 0,
|
||||
'priceModify': [0],
|
||||
'offset': 0
|
||||
'consumePrice': item.price
|
||||
// 'discount': 0,
|
||||
// 'discountOriginPrice': 0,
|
||||
// 'produceIntegral': 0,
|
||||
// 'priceModify': [0],
|
||||
// 'offset': 0
|
||||
}
|
||||
))
|
||||
};
|
||||
@@ -213,16 +221,25 @@ const payment = async () => {
|
||||
|
||||
const result = await orderCreate(params);
|
||||
orderBean.value!.id = result.id;
|
||||
|
||||
// let signParams = buildSignParams.value;
|
||||
// const signStr = parseParameter(signParams) + '&key=' + terminalInfo.value.terminalKey;
|
||||
// const sign = hexMD5(signStr).toUpperCase();
|
||||
// payParams.value = {
|
||||
// ...signParams,
|
||||
// sign: sign
|
||||
// };
|
||||
|
||||
const paymentList = await getPaymentList(orderBean.value?.id || '');
|
||||
console.log('----------->>>>>orderBean.value ', orderBean.value);
|
||||
const paymentParams = {
|
||||
orderId: orderBean?.value?.id,
|
||||
produceIntegralNumber: Math.round((orderBean?.value?.totalPrice || 0) + (orderBean?.value?.useGold || 0)),
|
||||
transactionPrice: orderBean?.value?.totalPrice,
|
||||
useGold: orderBean.value?.useGold || 0,
|
||||
detailBos: [{
|
||||
integralNumber: orderBean?.value?.totalPrice || 0,
|
||||
onlinePayResult: '',
|
||||
payName: '收钱吧',
|
||||
payTypeId: paymentList.find((res: any) => res.type === 'ShouQianBa')?.id,
|
||||
transactionPrice: Number(orderBean?.value?.totalPrice)
|
||||
}]
|
||||
};
|
||||
await overPayment(paymentParams);
|
||||
uni.navigateBack();
|
||||
uni.hideLoading();
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -278,7 +295,7 @@ const payment = async () => {
|
||||
margin-left: 20rpx;
|
||||
margin-right: 20rpx;
|
||||
|
||||
text:nth-of-type(1) {
|
||||
.status {
|
||||
padding: 2rpx 10rpx;
|
||||
font-size: 24rpx;
|
||||
color: #F32B2B;
|
||||
|
@@ -1,33 +1,34 @@
|
||||
<template>
|
||||
<view class='card-view'>
|
||||
<view class='card-view' @click.stop='emits("onChecked",item)'>
|
||||
<view class='c-flex-row'>
|
||||
<text>默认</text>
|
||||
<text class='status' v-if='item?.defaultstatus==1'>默认</text>
|
||||
<text>
|
||||
黄先生
|
||||
<!-- {{ item.name }}-->
|
||||
{{ item?.name }}
|
||||
</text>
|
||||
<text>
|
||||
13xxxxxx8900
|
||||
<!-- {{ item.mobile }}-->
|
||||
{{ item?.mobile }}
|
||||
</text>
|
||||
</view>
|
||||
<text class='address'>
|
||||
湖南省 长沙市 雨花区 地址地址地址
|
||||
{{ item.address }}
|
||||
{{ item?.addr }}
|
||||
</text>
|
||||
|
||||
<view class='btn-view c-flex-row'>
|
||||
<text>编辑</text>
|
||||
<text>删除</text>
|
||||
<text @click.stop='emits("onEdit",item)'>编辑</text>
|
||||
<text @click.stop='emits("onDelete",item)'>删除</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang='ts' setup>
|
||||
|
||||
import { PropType } from 'vue';
|
||||
|
||||
defineProps({
|
||||
item: <any>[]
|
||||
item: Object as PropType<{ name: string, mobile: string, addr: string, defaultstatus: number }>
|
||||
});
|
||||
const emits = defineEmits(['onEdit', 'onDelete', 'onChecked']);
|
||||
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
@@ -36,7 +37,7 @@ defineProps({
|
||||
padding: 38rpx 30rpx 30rpx 34rpx;
|
||||
|
||||
view:nth-of-type(1) {
|
||||
text:nth-of-type(1) {
|
||||
.status {
|
||||
border-radius: 5rpx;
|
||||
border: 1rpx solid #F32B2B;
|
||||
color: #F32B2B;
|
||||
|
@@ -2,13 +2,13 @@
|
||||
<view class='content'>
|
||||
<view class='c-flex-row'>
|
||||
<text>收货人</text>
|
||||
<input placeholder='请输入收货人姓名' @input='bindConsignee' />
|
||||
<input placeholder='请输入收货人姓名' v-model='params.name' @input='bindConsignee' />
|
||||
</view>
|
||||
|
||||
<view class='divider' />
|
||||
<view class='c-flex-row'>
|
||||
<text>手机号</text>
|
||||
<input placeholder='请输入收货人手机号' @input='bindMobile' :maxlength='11' />
|
||||
<input placeholder='请输入收货人手机号' v-model='params.mobile' @input='bindMobile' :maxlength='11' />
|
||||
</view>
|
||||
|
||||
<view class='divider' />
|
||||
@@ -16,6 +16,7 @@
|
||||
<text>详细地址</text>
|
||||
<view class='c-flex-column'>
|
||||
<textarea placeholder='详细地址:如街道、门牌\n号、楼栋号、单元室等'
|
||||
v-model='params.addr'
|
||||
@input='bindAddress' />
|
||||
<view class='tips-view c-flex-row'>
|
||||
<image :src='assetsUrl("ic_tips.png")' />
|
||||
@@ -29,7 +30,7 @@
|
||||
<text style='width: auto'>设为默认地址</text>
|
||||
<text style='width: auto'>提醒:每次下单会默认推荐使用该地址</text>
|
||||
<!-- @change='ev=>{params.defaultstatus = ev.detail.value}'-->
|
||||
<switch color='#F32B2B' @change='bindStatus' />
|
||||
<switch color='#F32B2B' @change='bindStatus' :checked='params.defaultstatus == 1' />
|
||||
</view>
|
||||
|
||||
<view class='bottom-button-view'>
|
||||
@@ -41,15 +42,17 @@
|
||||
<script lang='ts' setup>
|
||||
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import { addressCreate } from '@/api/user';
|
||||
import { addressCreate, addressUpdate } from '@/api/user';
|
||||
|
||||
const params = ref<{
|
||||
addrid: string,
|
||||
name: string,
|
||||
mobile: string,
|
||||
zonecode: string,
|
||||
addr: string,
|
||||
defaultstatus: number
|
||||
}>({
|
||||
addrid: '',
|
||||
name: '',
|
||||
mobile: '',
|
||||
zonecode: '',
|
||||
@@ -57,6 +60,12 @@ const params = ref<{
|
||||
defaultstatus: 0
|
||||
});
|
||||
|
||||
onLoad(async (e: any) => {
|
||||
// const result = await getAddressDetail(e.addrid);
|
||||
params.value = JSON.parse(decodeURIComponent(e.bean));
|
||||
console.log('----------->>>', params.value);
|
||||
});
|
||||
|
||||
const bindConsignee = (e: any) => {
|
||||
params.value.name = e.detail.value;
|
||||
};
|
||||
@@ -73,17 +82,25 @@ const bindStatus = (e: any) => {
|
||||
params.value.defaultstatus = e.detail.value == true ? 1 : 0;
|
||||
};
|
||||
|
||||
const save = () => {
|
||||
addressCreate(
|
||||
{
|
||||
bean: params.value
|
||||
}
|
||||
).then(() => {
|
||||
const save = async () => {
|
||||
let result = false;
|
||||
if(params.value.addrid) {
|
||||
result = await addressUpdate(params.value);
|
||||
} else {
|
||||
result = await addressCreate(
|
||||
params.value
|
||||
);
|
||||
}
|
||||
|
||||
if(result === true) {
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'none'
|
||||
icon: 'none',
|
||||
success(result) {
|
||||
uni.navigateBack();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@@ -1,7 +1,10 @@
|
||||
<template>
|
||||
<view class='content'>
|
||||
<scroll-view :scroll-y='true'>
|
||||
<item v-for='(item,index) in addressList' :key='index' :item='item' />
|
||||
<item v-for='(item,index) in addressList' :key='index' :item='item'
|
||||
@on-checked='onChecked(item)'
|
||||
@on-edit='args => goPath(`create?bean=${encodeURIComponent(JSON.stringify(args))}`)'
|
||||
@on-delete='args => {addressDelete(args?.addrid);fetchAddressList}' />
|
||||
</scroll-view>
|
||||
|
||||
<view class='bottom-button-view'>
|
||||
@@ -14,13 +17,17 @@
|
||||
|
||||
import Item from './components/item.vue';
|
||||
import { goPath } from '@/utils';
|
||||
import { getAddressList } from '@/api/user';
|
||||
import { addressDelete, getAddressList } from '@/api/user';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
const addressList = ref<{
|
||||
name: string,
|
||||
mobile: string,
|
||||
address: string,
|
||||
status: number
|
||||
addr: string,
|
||||
status: number,
|
||||
defaultstatus: number,
|
||||
}[]>([]);
|
||||
|
||||
onLoad((e) => {
|
||||
@@ -32,8 +39,12 @@ onShow(() => {
|
||||
});
|
||||
|
||||
const fetchAddressList = async () => {
|
||||
const { data } = await getAddressList();
|
||||
addressList.value = data;
|
||||
addressList.value = await getAddressList();
|
||||
};
|
||||
|
||||
const onChecked = (e: any) => {
|
||||
uni.navigateBack();
|
||||
userStore.setDeliveryAddress(e);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@@ -94,7 +94,7 @@
|
||||
</view>
|
||||
|
||||
<view class='bottom-action-view c-flex-row' v-if='orderBean?.order.payStatus==1'>
|
||||
<text @click.stop='cancel'>取消订单</text>
|
||||
<text @click.stop='cancel' style='display: none'>取消订单</text>
|
||||
<sqb-pay @bindnavigateTo='navigateTo'
|
||||
:return_url='buildSqbParams.return_url'
|
||||
:total_amount='buildSqbParams.total_amount'
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<view class='content'>
|
||||
<view class='top-card-view'>
|
||||
<image class='bg-image' :src='companyConfigInfo.userbgcover' />
|
||||
<image class='avatar-image' :src='params.avatarUrl' />
|
||||
<image class='avatar-image' :src='params.image' />
|
||||
<text>{{ userInfo.name }}</text>
|
||||
<text>{{ userInfo.levelName }}</text>
|
||||
</view>
|
||||
@@ -11,7 +11,7 @@
|
||||
<view class='c-flex-row'>
|
||||
<text>头像</text>
|
||||
<view class='avatar-view'>
|
||||
<image class='avatar-image' :src='params.avatarUrl' />
|
||||
<image class='avatar-image' :src='params.image' />
|
||||
<button class='avatar-btn' open-type='chooseAvatar' @chooseavatar='chooseAvatar' />
|
||||
</view>
|
||||
</view>
|
||||
@@ -24,7 +24,9 @@
|
||||
<view class='divider' />
|
||||
<view class='c-flex-row'>
|
||||
<text>手机号</text>
|
||||
<input placeholder='请输入手机号' v-model='userInfo.telephone' @input='bindTelephone' />
|
||||
<input placeholder='请输入手机号' :disabled='userInfo.telephone.length!=0'
|
||||
v-model='params.telephone'
|
||||
@input='bindTelephone' />
|
||||
</view>
|
||||
|
||||
<view class='divider' />
|
||||
@@ -32,12 +34,12 @@
|
||||
<text>性别</text>
|
||||
<view class='c-flex-row' @click.stop='changeGender(0)'>
|
||||
<image class='gender-image'
|
||||
:src='assetsUrl(params?.gender==0?"ic_checkbox_active.png":"ic_checkbox_normal.png")' />
|
||||
:src='assetsUrl(params?.gender=="男"?"ic_checkbox_active.png":"ic_checkbox_normal.png")' />
|
||||
<text class='gender-text'>男</text>
|
||||
</view>
|
||||
<view class='c-flex-row' @click.stop='changeGender(1)'>
|
||||
<image class='gender-image'
|
||||
:src='assetsUrl(params?.gender==1?"ic_checkbox_active.png":"ic_checkbox_normal.png")' />
|
||||
:src='assetsUrl(params?.gender=="女"?"ic_checkbox_active.png":"ic_checkbox_normal.png")' />
|
||||
<text class='gender-text'>女</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -45,7 +47,7 @@
|
||||
<view class='divider' />
|
||||
<view class='c-flex-row'>
|
||||
<text>生日</text>
|
||||
<picker mode='date' @change='changeDate'>
|
||||
<picker mode='date' :disabled='userInfo.birthday!=""' @change='changeDate'>
|
||||
<text>{{ params?.birthday || '请选择生日' }}</text>
|
||||
</picker>
|
||||
</view>
|
||||
@@ -59,16 +61,18 @@
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import { useUserStore } from '@/store';
|
||||
import { showToast } from '@/utils';
|
||||
import { updateProfile } from '@/api/user';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const store = useUserStore();
|
||||
const { userInfo,companyConfigInfo } = storeToRefs(store);
|
||||
const { userInfo, companyConfigInfo } = storeToRefs(store);
|
||||
|
||||
const params = ref<{
|
||||
avatarUrl: string;
|
||||
avatarUrl: string | undefined;
|
||||
image: string;
|
||||
nickName: string;
|
||||
telephone: string;
|
||||
gender: number;
|
||||
gender: string;
|
||||
birthday: string;
|
||||
}>({
|
||||
avatarUrl: userInfo.value.image,
|
||||
@@ -106,7 +110,6 @@ const chooseAvatar = (e: any) => {
|
||||
};
|
||||
|
||||
const bindNickname = (e: any) => {
|
||||
console.log('---------->>>>', e.detail.value);
|
||||
params.value!.nickName = e.detail.value;
|
||||
};
|
||||
|
||||
@@ -115,7 +118,7 @@ const bindTelephone = (e: any) => {
|
||||
};
|
||||
|
||||
const changeGender = (index: number) => {
|
||||
params.value!.gender = index;
|
||||
params.value!.gender = index == 0 ? '男' : '女';
|
||||
};
|
||||
|
||||
const changeDate = (e: any) => {
|
||||
@@ -123,13 +126,30 @@ const changeDate = (e: any) => {
|
||||
};
|
||||
|
||||
const save = async () => {
|
||||
console.log('---------->>>>', params.value);
|
||||
const newUserInfo = {
|
||||
...userInfo.value,
|
||||
...params.value
|
||||
};
|
||||
console.log('---------->>>>', newUserInfo);
|
||||
store.setUserInfo(newUserInfo);
|
||||
|
||||
delete params.value.avatarUrl;
|
||||
|
||||
const result = await updateProfile({
|
||||
...params.value,
|
||||
birthday: dayjs(params.value.birthday).format('YYYY-MM-DD HH:mm:ss'),
|
||||
birthdayType: 0
|
||||
});
|
||||
|
||||
if(result) {
|
||||
await store.setUserInfo(newUserInfo);
|
||||
uni.showToast({
|
||||
title: '修改成功',
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
success(result) {
|
||||
uni.navigateBack();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
@@ -47,7 +47,7 @@
|
||||
<script lang='ts' setup>
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import { useUserStore } from '@/store';
|
||||
import { getRechargeList, recharge } from '@/api/user';
|
||||
import { getRechargeList, preRecharge, recharge, rechargeVerify } from '@/api/user';
|
||||
import { parseParameter, sortASCII } from '@/utils';
|
||||
import { hexMD5 } from '@/utils/common/md5';
|
||||
|
||||
@@ -62,6 +62,7 @@ const rechargeItems = ref<{
|
||||
rechargetype: number
|
||||
}[]>([]);
|
||||
const currentIndex = ref<number>(0);
|
||||
const preRechargeOrderId = ref();
|
||||
|
||||
onLoad(async () => {
|
||||
const { ruleitems } = await getRechargeList();
|
||||
@@ -69,14 +70,17 @@ onLoad(async () => {
|
||||
change(0);
|
||||
});
|
||||
|
||||
const change = (index: number) => {
|
||||
const change = async (index: number) => {
|
||||
currentIndex.value = index;
|
||||
const { id } = await preRecharge({
|
||||
itemid: rechargeItems.value[index].itemid
|
||||
});
|
||||
preRechargeOrderId.value = id;
|
||||
};
|
||||
|
||||
const buildSqbParams = computed(() => {
|
||||
const params = sortASCII({
|
||||
// client_sn: rechargeItems.value[currentIndex.value]?.itemid || '',
|
||||
client_sn: Date.now().toString(),
|
||||
client_sn: preRechargeOrderId.value,
|
||||
return_url: '/pages/common/payresult/index',
|
||||
total_amount: ((rechargeItems.value[currentIndex.value]?.rechargeamount || 0) * 100).toString(),
|
||||
terminal_sn: terminalInfo.value.terminalSn,
|
||||
@@ -102,11 +106,16 @@ const navigateTo = (e: any) => {
|
||||
});
|
||||
};
|
||||
|
||||
const goRecharge = () => {
|
||||
const goRecharge = async () => {
|
||||
console.log(buildSqbParams.value);
|
||||
recharge({
|
||||
const result = await recharge({
|
||||
itemid: rechargeItems.value[currentIndex.value].itemid
|
||||
});
|
||||
console.log('---------->>> recharge result ', result);
|
||||
|
||||
await rechargeVerify({
|
||||
payid: preRechargeOrderId.value
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@@ -1,17 +1,17 @@
|
||||
<template>
|
||||
<view class='card-view'>
|
||||
<!-- <text class='category-title'>2023-02-12</text>-->
|
||||
<view class='item c-flex-column' v-for='(item,index) in 3' :key='index'>
|
||||
<view class='c-flex-row'>
|
||||
<text class='primary-text-color' style='flex: 1'>消费</text>
|
||||
<text class='accent-text-color'>-30</text>
|
||||
</view>
|
||||
<view class='c-flex-row'>
|
||||
<text class='secondary-text-color' style='flex: 1'>2023-06-27 15:02:11</text>
|
||||
<text style='color: #999999'>会员余额:¥30.00</text>
|
||||
</view>
|
||||
<view class='divider' style='margin-top: 20rpx' />
|
||||
<!-- <view class='item c-flex-column' v-for='(item,index) in 3' :key='index'>-->
|
||||
<view class='c-flex-row'>
|
||||
<text class='primary-text-color' style='flex: 1'>{{ item.name }}</text>
|
||||
<text class='accent-text-color'>-{{ item.transactionPrice || 0 }}</text>
|
||||
</view>
|
||||
<view class='c-flex-row'>
|
||||
<text class='secondary-text-color' style='flex: 1'>{{ item.createTime }}</text>
|
||||
<text style='color: #999999'>会员余额:¥{{ item.finalPrice || 0 }}</text>
|
||||
</view>
|
||||
<!-- <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 {
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<text>选择日期</text>
|
||||
<picker mode='date' @change='changeDate'>
|
||||
<view class='current-date c-flex-row'>
|
||||
<text>2024-02-10</text>
|
||||
<text>{{ tradeDate }}</text>
|
||||
<image :src='assetsUrl("ic_triangle_down.png")' />
|
||||
</view>
|
||||
</picker>
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
<u-list @scrolltolower='loadMore'>
|
||||
<trade-item v-for='(item,index) in tradeList' :key='index' :item='item' />
|
||||
<u-loadmore status='loading' />
|
||||
</u-list>
|
||||
</view>
|
||||
</template>
|
||||
@@ -21,20 +22,53 @@
|
||||
<script lang='ts' setup>
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import TradeItem from './components/trade-item.vue';
|
||||
import { getTradeList } from '@/api/user';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const tradeList = ref([1, 2, 3, 4, 5]);
|
||||
const tradeList = ref([]);
|
||||
const tradeType = ref('全部');
|
||||
const tradeDate = ref();
|
||||
const currentPageNum = ref(1);
|
||||
|
||||
const changeDate = () => {
|
||||
onLoad((e) => {
|
||||
tradeDate.value = dayjs(Date.now()).format('YYYY-MM-DD');
|
||||
fetchData();
|
||||
});
|
||||
|
||||
const changeDate = (e: any) => {
|
||||
tradeDate.value = e.detail.value;
|
||||
fetchData();
|
||||
};
|
||||
|
||||
const changeTab = (index: number) => {
|
||||
switch (index) {
|
||||
case 0:
|
||||
tradeType.value = '全部';
|
||||
break;
|
||||
case 1:
|
||||
tradeType.value = '会员充值';
|
||||
break;
|
||||
case 2:
|
||||
tradeType.value = '余额消费';
|
||||
break;
|
||||
}
|
||||
fetchData();
|
||||
};
|
||||
|
||||
const fetchData = (refresh: boolean = true) => {
|
||||
const fetchData = async (refresh: boolean = true) => {
|
||||
currentPageNum.value = refresh ? 1 : currentPageNum.value + 1;
|
||||
const { list } = await getTradeList({
|
||||
startDate: tradeDate.value,
|
||||
endDate: tradeDate.value,
|
||||
name: tradeType.value,
|
||||
pageNum: currentPageNum.value,
|
||||
pageSize: 20
|
||||
});
|
||||
if(refresh) {
|
||||
tradeList.value = list;
|
||||
} else {
|
||||
tradeList.value = tradeList.value.concat(list);
|
||||
}
|
||||
};
|
||||
|
||||
const loadMore = () => {
|
||||
@@ -60,7 +94,7 @@ const loadMore = () => {
|
||||
image {
|
||||
width: 19rpx;
|
||||
height: 11rpx;
|
||||
margin-left: 57rpx;
|
||||
margin-left: 15rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@@ -17,6 +17,13 @@ const useUserStore = defineStore('user', {
|
||||
mallopen: 0,
|
||||
regqrcode: undefined,
|
||||
userbgcover: undefined
|
||||
},
|
||||
deliveryAddress: {
|
||||
addrid: '',
|
||||
name: '',
|
||||
mobile: '',
|
||||
addr: '',
|
||||
defaultstatus: 0
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -50,6 +57,10 @@ const useUserStore = defineStore('user', {
|
||||
await this.fetchTerminal();
|
||||
},
|
||||
|
||||
setDeliveryAddress(partial: Partial<any>) {
|
||||
this.deliveryAddress = partial as any;
|
||||
},
|
||||
|
||||
// 重置用户信息
|
||||
resetInfo() {
|
||||
this.$reset();
|
||||
@@ -119,11 +130,11 @@ const useUserStore = defineStore('user', {
|
||||
gender: res.user.gender
|
||||
};
|
||||
const registerResult = await this.userRegister(registerForm);
|
||||
this.setUserInfo(registerResult as LoginResult);
|
||||
await this.setUserInfo(registerResult as LoginResult);
|
||||
setToken(res.token);
|
||||
setCompanyId(res.user.companyId);
|
||||
} else {
|
||||
this.setUserInfo(res.user);
|
||||
await this.setUserInfo(res.user);
|
||||
setToken(res.token);
|
||||
setCompanyId(res.user.companyId);
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ export interface UserBean {
|
||||
creatorName: string;
|
||||
customerPrice: string;
|
||||
email: string;
|
||||
gender: number;
|
||||
gender: string;
|
||||
gold: string;
|
||||
goodsNum: number;
|
||||
id: string;
|
||||
|
Reference in New Issue
Block a user