功能完善
This commit is contained in:
@@ -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>
|
||||
|
Reference in New Issue
Block a user