小程序端页面调整

This commit is contained in:
2024-03-21 10:29:45 +08:00
parent ab338be7a9
commit 06b494b438
23 changed files with 1200 additions and 125 deletions

View File

@@ -4,16 +4,19 @@
"version": "0.0",
"configurations": [
{
"default": {
"launchtype": "local"
},
"h5": {
"launchtype": "local"
},
"mp-weixin": {
"launchtype": "local"
},
"type": "uniCloud"
"app-plus": {
"launchtype": "local"
},
"default": {
"launchtype": "local"
},
"h5": {
"launchtype": "local"
},
"mp-weixin": {
"launchtype": "local"
},
"type": "uniCloud"
}
]
}

View File

@@ -27,10 +27,10 @@ const post_update_user = '/user/weixin/auth/updateUser' // 更新用户信息
const get_find_user_order = '/order/auth/findUserOrderPage' // 获取用户订单信息
const get_weixin_payment = '/payment/weixin/createJsapi' // 获取微信支付信息
const get_order_status = '/payment/weixin/queryPayStatus' // 获取订单状态
// 后续需求
const get_account_login = '/user/h5/login' // 用户登陆
const post_register = '/user/h5/register' // 用户注册
// 后续需求
const post_h5_update_user = '/user/h5/auth/updateUser' // 更新用户信息
const get_alipay_payment = '/payment/alipay/createJsapi' // 获取支付宝支付信息
const get_order_alipay_status = '/payment/alipay/queryPayStatus' // 获取订单状态
@@ -42,7 +42,7 @@ const install = (Vue, vm) => {
// 获取首页数据
const getHomeIndex = () => vm.$u.get(get_home_index);
/*---------------------------------------------------------
提货点模块
提货点模块
---------------------------------------------------------*/
// 根据经纬度获取地址信息
const getBaiduMapAddress = (o) => vm.$u.get(get_baidu_map_address + `${o.latitude},${o.longitude}`)
@@ -60,7 +60,7 @@ const install = (Vue, vm) => {
showLoading: false
})
/*---------------------------------------------------------
商品模块
商品模块
---------------------------------------------------------*/
// 获取分类
const getCategories = () => vm.$u.get(get_categories, {
@@ -75,14 +75,14 @@ const install = (Vue, vm) => {
// 商品详情
const getHomeItem = (o) => vm.$u.get(get_home_item + `/${o.skuId}`);
/*---------------------------------------------------------
秒杀模块
秒杀模块
---------------------------------------------------------*/
// 从缓存中查询时间段列表
const getFindAllSeckillTimeList = () => vm.$u.get(get_find_all_sec_kill_time_list);
// 从缓存中读取秒杀sku
const getFindSeckillSkuList = (o) => vm.$u.get(get_find_sec_kill_sku_list + `/${o.timeName}`);
/*---------------------------------------------------------
购物车模块
购物车模块
---------------------------------------------------------*/
// 加入购物车
const getAddToCart = (o) => vm.$u.get(get_add_to_cart + `/${o.skuId}/${o.skuNum}`, {
@@ -118,12 +118,14 @@ const install = (Vue, vm) => {
const getOrderInfo = (o) => vm.$u.get(get_order_info + `/${o.orderId}`)
// 获取微信支付信息
const getWxPayment = (o) => vm.$u.get(get_weixin_payment + `/${o.orderNo}`)
// 获取支付宝支付信息
const getAliPayment = (o) => vm.$u.get(get_alipay_payment + `/${o.orderNo}`)
// 获取订单状态信息
const getOrderStatus = (o) => vm.$u.get(get_order_status + `/${o.orderNo}`)
/*---------------------------------------------------------
用户登陆
用户登陆
---------------------------------------------------------*/
// 微信用户登陆
const getWxLogin = (o) => vm.$u.get(get_wx_login + `/${o.code}`, {
@@ -131,10 +133,8 @@ const install = (Vue, vm) => {
})
// 账号密码登登录
const getAccountLogin = (o) => vm.$u.post(get_account_login, o)
// 用户注册
const postRegister = (o) => vm.$u.post(post_register, o)
// '/user/h5/register' // 用户注册
// 更新用户信息
const postUpdateUser = (o) => vm.$u.post(post_update_user, {
...o,
@@ -168,6 +168,7 @@ const install = (Vue, vm) => {
postSubmitOrder,
getOrderInfo,
getWxPayment,
getAliPayment,
getWxLogin,
getAccountLogin,
postRegister,

View File

@@ -21,7 +21,7 @@ const install = (Vue, vm) => {
} else if (res.code == 208) {
// 未登陆token过期
uni.reLaunch({
url: '/pages/login/login'
url: '/pages/loginh5/loginh5'
})
return false;
} else {

View File

@@ -14,36 +14,22 @@
<view v-for="(cartInfoListItem, index) in getCartInfoList" :key="index">
<u-card :border="false" :padding="10" :show-head="showMultiCheckbox(index)">
<view slot="head" class="u-m-10">
<u-checkbox
:name="getMultiCheckedIds(index)"
:value="getMultiCheckCart(index)"
active-color="red"
shape="circle"
@change="changeMultiChecked"
></u-checkbox>
<u-checkbox :name="getMultiCheckedIds(index)" :value="getMultiCheckCart(index)"
active-color="red" shape="circle" @change="changeMultiChecked"></u-checkbox>
<text>{{ cartInfoListItem.activityRule.ruleDesc }}</text>
</view>
<view slot="body">
<view v-for="(cartInfoItem, idx) in cartInfoListItem.cartInfoList" :key="idx">
<!-- 动态class绑定是为了确保最后一条底部线条不显示 -->
<view :class="{ 'u-border-bottom': idx !== cartInfoListItem.cartInfoList.length - 1 }"
class="u-body-item u-flex u-col-between u-p-10">
<u-checkbox
v-model="cartInfoItem.isChecked"
:name="cartInfoItem.skuId"
active-color="red"
shape="circle"
@change="changeChecked"
></u-checkbox>
<ListImgItem
:lazyLoad="false"
:showBottom="cartInfoItem.skuType === 0 && cartInfoItem.isNewPerson === 1"
:showLeft="cartInfoItem.skuType === 1"
:showRight="false"
:src="cartInfoItem.imgUrl"
height="200rpx"
width="200rpx"
></ListImgItem>
<view
:class="{ 'u-border-bottom': idx !== cartInfoListItem.cartInfoList.length - 1 }"
class="u-body-item u-flex u-col-between u-p-10">
<u-checkbox v-model="cartInfoItem.isChecked" :name="cartInfoItem.skuId"
active-color="red" shape="circle" @change="changeChecked"></u-checkbox>
<ListImgItem :lazyLoad="false"
:showBottom="cartInfoItem.skuType === 0 && cartInfoItem.isNewPerson === 1"
:showLeft="cartInfoItem.skuType === 1" :showRight="false"
:src="cartInfoItem.imgUrl" height="200rpx" width="200rpx"></ListImgItem>
<view class="u-p-b-20 u-m-l-20" style="flex:1">
<view class="u-font-lg">{{ cartInfoItem.skuName }}</view>
<view class="u-flex u-row-between">
@@ -51,7 +37,8 @@
<text></text>
<text>{{ cartInfoItem.cartPrice }}</text>
</view>
<AddToCart :shopDetail="cartInfoItem" :skuId="cartInfoItem.skuId"></AddToCart>
<AddToCart :shopDetail="cartInfoItem" :skuId="cartInfoItem.skuId">
</AddToCart>
</view>
</view>
</view>
@@ -79,7 +66,9 @@
<view class="u-font-xs u-type-info">
优惠券优惠:{{ getCartPriceInfo.couponReduceAmount }}
<text class="u-font-xs u-m-l-20 u-type-info">原价:</text>
<text class="u-font-xs u-type-info">{{ getCartPriceInfo.originalTotalAmount }}</text>
<text
class="u-font-xs u-type-info">{{ getCartPriceInfo.originalTotalAmount }}
</text>
</view>
</view>
</view>
@@ -95,8 +84,8 @@
</view>
</view>
<CouponInfoList :couponInfoList="getCartCouponInfoList"
:showCouponInfoList.sync="showCouponInfoList"></CouponInfoList>
<CouponInfoList :couponInfoList="getCartCouponInfoList" :showCouponInfoList.sync="showCouponInfoList">
</CouponInfoList>
</view>
</template>
@@ -122,7 +111,9 @@ export default {
])
},
methods: {
...mapActions('cartModule', ['getActivityCartListAction', 'changeCheckCartAction', 'changeMultiCheckedCartAction', 'changeAllCheckCartAction']),
...mapActions('cartModule', ['getActivityCartListAction', 'changeCheckCartAction',
'changeMultiCheckedCartAction', 'changeAllCheckCartAction'
]),
...mapActions('cartModule', ['getCartListAction']),
// 到分类页购买商品
gotoCategory() {
@@ -133,20 +124,31 @@ export default {
// 修改单个商品选中状态
changeChecked(detail) {
let isChecked = 1;
const {name: skuId, value} = detail;
const {
name: skuId,
value
} = detail;
if (!value) isChecked = 0;
this.changeCheckCartAction({skuId, isChecked});
this.changeCheckCartAction({
skuId,
isChecked
});
},
// 修改多个商品的选中状态
changeMultiChecked(detail) {
let skuIdList = [];
skuIdList = detail.name.split(',');
const isChecked = detail.value === true ? 1 : 0;
this.changeMultiCheckedCartAction({skuIdList, isChecked});
this.changeMultiCheckedCartAction({
skuIdList,
isChecked
});
},
// 全部选中/返选
changeAllSelected(detail) {
this.changeAllCheckCartAction({isChecked: detail.value === true ? 1 : 0});
this.changeAllCheckCartAction({
isChecked: detail.value === true ? 1 : 0
});
},
// 跳转至确认订单
gotoConfirmOrder() {
@@ -156,7 +158,9 @@ export default {
// 思考为什么需要将请求放置于onShow钩子函数中
// 主要考虑tabs切换后需要进行实时数据的获取
onShow() {
this.getActivityCartListAction({showLoading: true});
this.getActivityCartListAction({
showLoading: true
});
},
mounted() {
// 需要获取购物车数据列表,将最新获取的数据渲染到页面

View File

@@ -22,6 +22,8 @@
</view>
<view class="buttons">
<button class="otherBtn" @click="goToRegister">注册</button>
<!-- 添加空白间距 -->
<div style="width: 20px; display: inline-block;"></div>
<button class="otherBtn" @click="goToLogin">账号密码登录</button>
</view>
</view>

View File

@@ -0,0 +1,166 @@
<template>
<view class="wrap">
<view class="content">
<view class="title">欢迎登录小鹿超市</view>
</view>
<view class="buttom">
<view class="loginType">
<view class="accountLogin item">
<input v-model="username" class="input" placeholder="请输入账号" type="text"/>
<input v-model="password" class="input" placeholder="请输入密码" type="password"/>
<button :disabled="isLogin" class="loginBtn" @click="loginWithAccount">
账号密码登录
</button>
</view>
</view>
<view class="hint">
登录代表同意
<text class="link">小鹿超市用户协议隐私政策</text>
并授权使用您的小鹿超市账号信息如昵称头像收获地址以便您统一管理
</view>
<view class="buttons">
<button class="otherBtn" @click="goToRegister">注册</button>
<!-- 添加空白间距 -->
<div style="width: 20px; display: inline-block;"></div>
<button class="otherBtn" @click="goToWechatLogin">微信登录</button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
isLogin: false,
username: '',
password: ''
};
},
methods: {
async loginWithAccount() {
this.isLogin = true;
// 做账号密码登录逻辑,替换以下代码为实际的登录操作
try {
// 假设这里进行了账号密码登录,并获取到了 token
const result = await this.$u.api.getAccountLogin({
phone: this.username,
password: this.password
});
console.log(result, result.token, "<<<")
// 将token值进行本地缓存存储
uni.setStorage({
key: 'token',
data: result.token,
success: async () => {
// 更新用户信息
// await this.$u.api.postUpdateUser({
// sex,
// photoUrl,
// nickName
// });
// 路由跳转至首页
uni.reLaunch({
url: '/pages/index/index',
});
}
});
} catch (error) {
console.error('登录失败:', error);
} finally {
this.isLogin = false;
}
},
goToRegister() {
uni.navigateTo({
url: '/pages/register/register',
});
},
goToWechatLogin() {
uni.navigateTo({
url: '/pages/login/login',
});
}
}
};
</script>
<style lang="scss" scoped>
// 样式略有修改以适应账号密码登录的布局
.wrap {
font-size: 28rpx;
.content {
width: 600rpx;
margin: 80rpx auto 0;
.title {
text-align: left;
font-size: 60rpx;
font-weight: 500;
margin-bottom: 100rpx;
}
}
.otherBtn {
width: 240rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
background-color: #ccc;
color: #fff;
font-size: 24rpx;
border: none;
border-radius: 10rpx;
cursor: pointer;
background-color: #1aad19; // 更改微信登录按钮的背景颜色
}
.buttom {
.loginType {
display: flex;
justify-content: center;
padding: 20rpx;
.accountLogin {
display: flex;
flex-direction: column;
align-items: center;
.input {
width: 400rpx;
height: 80rpx;
margin-bottom: 20rpx;
padding: 0 20rpx;
font-size: 28rpx;
border: 1px solid #ccc;
border-radius: 10rpx;
}
.loginBtn {
width: 400rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
background-color: rgb(83, 194, 64);
color: #fff;
font-size: 28rpx;
border: none;
border-radius: 10rpx;
cursor: pointer;
}
}
}
.hint {
padding: 20rpx 40rpx;
font-size: 24rpx;
color: #666;
.link {
color: rgb(83, 194, 64);
}
}
}
}
</style>

View File

@@ -107,12 +107,12 @@
<view class="u-font-xs">提货码</view>
</view>
</u-col>
<!-- <u-col span="3">
<view class="gg-order-item" @click="gotoMyPickUpLocation">
<view class="iconfont icon-dianpu"></view>
<view class="u-font-xs">提货点管理</view>
</view>
</u-col> -->
<u-col span="3">
<view class="gg-order-item" @click="logout">
<view class="iconfont icon-dianpu"></view>
<view class="u-font-xs">退出登录</view>
</view>
</u-col>
<u-col span="3">
<view class="gg-order-item">
<view class="iconfont icon-miaosha"></view>
@@ -204,11 +204,12 @@ export default {
gotoOrderList(index) {
this.$u.route('/pagesOrder/orderList/orderList?current=' + index);
},
// gotoMyPickUpLocation() {
// uni.navigateTo({
// url: '/pagesLocation/myPickUpLocation/myPickUpLocation'
// });
// }
logout() {
uni.removeStorageSync('token');
uni.navigateTo({
url: '/pages/loginh5/loginh5'
});
}
},
async mounted() {
this.userInfo = uni.getStorageSync('userInfo');

View File

@@ -0,0 +1,151 @@
<template>
<view class="wrap">
<view class="content">
<view class="title">欢迎注册小鹿超市</view>
</view>
<view class="buttom">
<view class="loginType">
<view class="accountLogin item">
<input v-model="username" class="input" placeholder="请输入手机号" type="text"/>
<input v-model="password" class="input" placeholder="请输入密码" type="password"/>
<button :disabled="isLogin" class="loginBtn" @click="register">
注册
</button>
</view>
</view>
<view class="hint">
注册代表同意
<text class="link">小鹿超市用户协议隐私政策</text>
并授权使用您的小鹿超市账号信息如昵称头像收获地址以便您统一管理
</view>
<view class="buttons">
<button class="otherBtn" @click="goToLogin">账号密码登录</button>
<!-- 添加空白间距 -->
<div style="width: 20px; display: inline-block;"></div>
<button class="otherBtn" @click="goToWechatLogin">微信登录</button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
isLogin: false,
username: '',
password: ''
};
},
methods: {
async register() {
this.isLogin = true;
try {
const result = await this.$u.api.postRegister({
phone: this.username,
password: this.password
});
console.log('注册成功:', result);
// 路由跳转至登录
uni.reLaunch({
url: '/pages/loginh5/loginh5',
});
} catch (error) {
console.error('登录失败:', error);
} finally {
this.isLogin = false;
}
},
goToLogin() {
uni.navigateTo({
url: '/pages/loginh5/loginh5',
});
},
goToWechatLogin() {
uni.navigateTo({
url: '/pages/login/login',
});
}
}
};
</script>
<style lang="scss" scoped>
// 样式略有修改以适应账号密码登录的布局
.wrap {
font-size: 28rpx;
.content {
width: 600rpx;
margin: 80rpx auto 0;
.title {
text-align: left;
font-size: 60rpx;
font-weight: 500;
margin-bottom: 100rpx;
}
}
.otherBtn {
width: 240rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
background-color: #ccc;
color: #fff;
font-size: 24rpx;
border: none;
border-radius: 10rpx;
cursor: pointer;
background-color: #1aad19; // 更改微信登录按钮的背景颜色
}
.buttom {
.loginType {
display: flex;
justify-content: center;
padding: 20rpx;
.accountLogin {
display: flex;
flex-direction: column;
align-items: center;
.input {
width: 400rpx;
height: 80rpx;
margin-bottom: 20rpx;
padding: 0 20rpx;
font-size: 28rpx;
border: 1px solid #ccc;
border-radius: 10rpx;
}
.loginBtn {
width: 400rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
background-color: rgb(83, 194, 64);
color: #fff;
font-size: 28rpx;
border: none;
border-radius: 10rpx;
cursor: pointer;
}
}
}
.hint {
padding: 20rpx 40rpx;
font-size: 24rpx;
color: #666;
.link {
color: rgb(83, 194, 64);
}
}
}
}
</style>

View File

@@ -14,10 +14,10 @@
</u-card> -->
<u-card :padding="10" :show-head="true">
<view slot="head" class="u-m-10">提货人联系方式</view>
<view slot="head" class="u-m-10">联系方式</view>
<view slot="body" class="u-m-10">
<u-input v-model="sumbitOrderForm.receiverName" class="u-p-b-20" placeholder="请输入提货人姓名"/>
<u-input v-model="sumbitOrderForm.receiverPhone" placeholder="请输入提货人电话" type="number"/>
<u-input v-model="sumbitOrderForm.receiverName" class="u-p-b-20" placeholder="请输入姓名"/>
<u-input v-model="sumbitOrderForm.receiverPhone" placeholder="请输入电话" type="number"/>
</view>
</u-card>
@@ -32,15 +32,10 @@
<!-- 动态class绑定是为了确保最后一条底部线条不显示 -->
<view :class="{ 'u-border-bottom': idx !== cartInfoListItem.cartInfoList.length - 1 }"
class="u-body-item u-flex u-col-between u-p-10">
<ListImgItem
:lazyLoad="false"
:showBottom="cartInfoItem.skuType === 0 && cartInfoItem.isNewPerson === 1"
:showLeft="cartInfoItem.skuType === 1"
:showRight="false"
:src="cartInfoItem.imgUrl"
height="200rpx"
width="200rpx"
></ListImgItem>
<ListImgItem :lazyLoad="false"
:showBottom="cartInfoItem.skuType === 0 && cartInfoItem.isNewPerson === 1"
:showLeft="cartInfoItem.skuType === 1" :showRight="false"
:src="cartInfoItem.imgUrl" height="200rpx" width="200rpx"></ListImgItem>
<view class="u-p-b-20 u-m-l-20" style="flex:1">
<view>{{ cartInfoItem.skuName }}</view>
<view>购买数量{{ cartInfoItem.skuNum }}</view>
@@ -61,25 +56,25 @@
<u-card v-if="getCartCouponInfoList.length > 0" :padding="10" :show-head="false">
<view slot="body">
<view class="coupon">
<view
v-for="couponInfoItem in getCartCouponInfoList"
:key="couponInfoItem.id"
:class="{ selected: couponInfoItem.selected }"
class="content u-m-b-20"
@click="switchCouponInfoItem(couponInfoItem)"
>
<view v-for="couponInfoItem in getCartCouponInfoList" :key="couponInfoItem.id"
:class="{ selected: couponInfoItem.selected }" class="content u-m-b-20"
@click="switchCouponInfoItem(couponInfoItem)">
<view class="left">
<view class="sum">
<text class="num">{{ couponInfoItem.amount }}</text>
</view>
<view class="type">{{ couponInfoItem.couponType === 'FULL_REDUCTION' ? '满减券' : '现金券' }}</view>
<view class="type">
{{ couponInfoItem.couponType === 'FULL_REDUCTION' ? '满减券' : '现金券' }}
</view>
<view class="type">{{ getRangeType(couponInfoItem.rangeType) }}</view>
</view>
<view class="centre">
<view class="title">{{ couponInfoItem.couponName }}</view>
<view class="u-type-info">{{ couponInfoItem.rangeDesc }}</view>
<view class="valid-date">过期时间{{ dayjs(couponInfoItem.expireTime).format('YYYY-MM-DD') }}</view>
<view class="valid-date">
过期时间{{ dayjs(couponInfoItem.expireTime).format('YYYY-MM-DD') }}
</view>
</view>
<view class="right">
<block v-if="couponInfoItem.isSelect === 1">
@@ -111,7 +106,9 @@
<view class="u-font-xs u-type-info">
优惠券优惠:{{ getCartPriceInfo.couponReduceAmount }}
<text class="u-font-xs u-m-l-20 u-type-info">原价:</text>
<text class="u-font-xs u-type-info">{{ getCartPriceInfo.originalTotalAmount }}</text>
<text
class="u-font-xs u-type-info">{{ getCartPriceInfo.originalTotalAmount }}
</text>
</view>
</view>
</view>
@@ -144,7 +141,9 @@ export default {
},
computed: {
...mapState('orderModule', ['order']),
...mapGetters('orderModule', ['getCartInfoList', 'getSelectedCount', 'getCartPriceInfo', 'getLeaderAddressVo', 'showMultiCheckbox', 'getCartCouponInfoList']),
...mapGetters('orderModule', ['getCartInfoList', 'getSelectedCount', 'getCartPriceInfo', 'getLeaderAddressVo',
'showMultiCheckbox', 'getCartCouponInfoList'
]),
getRangeType() {
return function (rangeType) {
switch (rangeType) {

View File

@@ -9,11 +9,11 @@
<scroll-view class="gg-cart-sv-container" scroll-y="true">
<!-- 提货点 -->
<u-card :padding="10" :show-head="true">
<view slot="head" class="u-m-10">提货人联系方式</view>
<view slot="head" class="u-m-10">联系方式</view>
<view slot="body" class="u-m-10">
<view class="u-p-20">收货人员{{ order.receiverName }}</view>
<view class="u-p-20">姓名{{ order.receiverName }}</view>
<view class="u-p-20">联系方式{{ order.receiverPhone }}</view>
<view class="u-p-20">提货地点{{ order.receiverAddress }}</view>
<view class="u-p-20">地点{{ order.receiverAddress }}</view>
</view>
</u-card>
@@ -28,8 +28,11 @@
<view class="u-font-xl">{{ orderItem.skuName }}</view>
<view>单价{{ orderItem.skuPrice }}</view>
<view>数量{{ orderItem.skuNum }}</view>
<view v-if="orderItem.splitActivityAmount > 0">活动金额:{{ orderItem.splitActivityAmount }}</view>
<view v-if="orderItem.splitCouponAmount > 0">优惠券:{{ orderItem.splitCouponAmount }}</view>
<view v-if="orderItem.splitActivityAmount > 0">
活动金:{{ orderItem.splitActivityAmount }}
</view>
<view v-if="orderItem.splitCouponAmount > 0">优惠券额:{{ orderItem.splitCouponAmount }}
</view>
<view>
小计
<text class="u-type-error">{{ orderItem.splitTotalAmount }}</text>
@@ -69,7 +72,8 @@
<view class="gg-navigation">
<view class="navigation">
<view class="buy btn u-line-1" @click="payOrder">支付订单</view>
<view class="buy btn u-line-1" @click="payWxOrder">微信支付订单</view>
<view class="buy btn u-line-1" @click="payAliOrder">支付宝支付订单</view>
</view>
</view>
</view>
@@ -91,7 +95,9 @@ export default {
},
methods: {
async getOrderInfoById(orderId) {
const result = await this.$u.api.getOrderInfo({orderId});
const result = await this.$u.api.getOrderInfo({
orderId
});
this.order = result;
},
copyOrderNo() {
@@ -106,8 +112,10 @@ export default {
}
});
},
async payOrder() {
const result = await this.$u.api.getWxPayment({orderNo: this.order.orderNo});
async payWxOrder() {
const result = await this.$u.api.getWxPayment({
orderNo: this.order.orderNo
});
wx.requestPayment({
timeStamp: result.timeStamp,
nonceStr: result.nonceStr,
@@ -115,7 +123,9 @@ export default {
signType: 'MD5',
paySign: result.paySign,
success: res => {
this.$u.api.getOrderStatus({orderNo: this.order.orderNo});
this.$u.api.getOrderStatus({
orderNo: this.order.orderNo
});
uni.showToast({
title: '支付成功',
icon: 'none'
@@ -131,7 +141,46 @@ export default {
});
}
});
},
async payAliOrder() {
try {
const result = await this.$u.api.getAliPayment({
orderNo: this.order.orderNo
});
my.tradePay({
tradeNO: result.tradeNO,
success: res => {
if (res.resultCode === '9000') {
this.$u.api.getOrderStatus({
orderNo: this.order.orderNo
});
uni.showToast({
title: '支付成功',
icon: 'none'
});
uni.switchTab({
url: '/pages/index/index'
});
} else {
throw new Error('支付失败');
}
},
fail: err => {
uni.showToast({
icon: 'none',
title: err.errorMessage || '支付失败'
});
}
});
} catch (error) {
uni.showToast({
icon: 'none',
title: error.message || '支付失败'
});
}
}
},
mounted() {
this.getOrderInfoById(this.orderId);

View File

@@ -36,7 +36,9 @@
</view>
<view class="total">
<text class="total-price">
<text class="decimal">现价{{ res.totalAmount }} 原价{{ res.originalTotalAmount }}</text>
<text class="decimal">现价{{ res.totalAmount }}
原价{{ res.originalTotalAmount }}
</text>
</text>
</view>
<view class="bottom">
@@ -45,6 +47,7 @@
</view>
<view class="logistics btn">查看物流</view>
<view class="exchange btn">卖了换钱</view>
<button class="evaluate btn" @click="getOrderInfo(res.id)">订单详情</button>
<view class="evaluate btn">评价</view>
</view>
</view>
@@ -63,14 +66,19 @@ export default {
data() {
return {
// 订单列表
orderList: [[], [], [], [], []],
orderList: [
[],
[],
[],
[],
[]
],
// 订单类型、状态与数量
list: [
{
name: '待付款',
orderStatus: 'UNPAID',
count: 0
},
list: [{
name: '待付款',
orderStatus: 'UNPAID',
count: 0
},
{
name: '待发货',
orderStatus: 'WAITING_DELEVER',
@@ -159,6 +167,9 @@ export default {
this.loadStatus.splice(idx, 1, 'nomore');
}
},
async getOrderInfo(id) {
this.$u.route(`/pagesOrder/getOrderInfo/getOrderInfo?orderId=${id}`);
},
// tab栏切换
change(index) {
this.swiperCurrent = index;