Merge branch 'master' of https://gitea.lihaink.cn/weipengfei/purchase-let
This commit is contained in:
commit
65d74155b5
|
@ -27,7 +27,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<up-button color="#20B128" shape="circle" @click="submitAddress">确认自点</up-button>
|
||||
<up-button color="#20B128" shape="circle" @click="submitAddress">确认提货点 </up-button>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
@ -56,8 +56,8 @@
|
|||
}
|
||||
|
||||
const submitAddress = () => {
|
||||
let e = props.list.find(item=>item.mer_id==addressType.value);
|
||||
if(addressType.value<=0 || !e) return uni.$u.toast('请选择提货点');
|
||||
let e = props.list.find(item => item.mer_id == addressType.value);
|
||||
if (addressType.value <= 0 || !e) return uni.$u.toast('请选择提货点');
|
||||
emit('change', e);
|
||||
}
|
||||
|
||||
|
@ -72,12 +72,12 @@
|
|||
})
|
||||
}
|
||||
|
||||
const setCheck = (e)=>{
|
||||
addressType.value = e;
|
||||
}
|
||||
defineExpose({
|
||||
setCheck
|
||||
})
|
||||
const setCheck = (e) => {
|
||||
addressType.value = e;
|
||||
}
|
||||
defineExpose({
|
||||
setCheck
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view class="head">
|
||||
<!-- -->
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,11 @@
|
|||
<template>
|
||||
<view class="">
|
||||
明细
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,165 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view class="total">
|
||||
<view class="">
|
||||
账户总余额(元)
|
||||
</view>
|
||||
<view style="font-size: 36rpx;">
|
||||
¥1860.00
|
||||
</view>
|
||||
</view>
|
||||
<view class="action">
|
||||
<view class="">
|
||||
提现至
|
||||
</view>
|
||||
<view style="font-weight: bold;">
|
||||
请选择提现账户
|
||||
</view>
|
||||
<view style="display: flex;align-items: center;color: #20B128;"
|
||||
@click="navgo('/pageQuota/Balance/bindAccout')">
|
||||
<text>绑定账户</text> <up-icon color="#20B128" name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form">
|
||||
|
||||
<!-- 注意,如果需要兼容微信小程序,最好通过setRules方法设置rules规则 -->
|
||||
<up-form labelPosition="left" borderBottom :label-style="{fontSize:'30rpx'}" :model="model1" :rules="rules"
|
||||
ref="form1" labelWidth='70'>
|
||||
<up-form-item label="银行卡" prop="userInfo.name" borderBottom ref="item1">
|
||||
<template #right>
|
||||
<view style="display: flex;align-items: center;">
|
||||
<text style="color: #20B128;">选择银行</text> <up-icon color="#20B128"
|
||||
name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</template>
|
||||
</up-form-item>
|
||||
<up-form-item label="持卡人" prop="userInfo.name" borderBottom ref="item1">
|
||||
<up-input style="border: none;" v-model="form.name" placeholder="请输入持卡人姓名" />
|
||||
</up-form-item>
|
||||
<up-form-item label="银行账户" prop="userInfo.name" borderBottom ref="item1">
|
||||
<up-input style="border: none;" v-model="form.name" placeholder="请输入银行账户" />
|
||||
</up-form-item>
|
||||
<up-form-item label="开户网点" prop="userInfo.name" borderBottom ref="item1">
|
||||
<up-input style="border: none;" v-model="form.name" placeholder="请输入开户网点" />
|
||||
</up-form-item>
|
||||
<up-form-item label="提现金额" prop="userInfo.name" borderBottom ref="item1">
|
||||
<up-input style="border: none;" v-model="form.name" placeholder="请输入提现金额" />
|
||||
</up-form-item>
|
||||
</up-form>
|
||||
</view>
|
||||
|
||||
<view class="submit-btn">
|
||||
<up-button text="提现" shape="circle" color="#50C758"></up-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive
|
||||
} from 'vue';
|
||||
|
||||
|
||||
const navgo = (url) => {
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
const form = reactive({
|
||||
name: ""
|
||||
})
|
||||
|
||||
// 使用 reactive 创建响应式状态
|
||||
const state = reactive({
|
||||
showSex: false,
|
||||
model1: {
|
||||
userInfo: {
|
||||
name: 'uview-plus UI',
|
||||
sex: '',
|
||||
},
|
||||
},
|
||||
actions: [{
|
||||
name: '男'
|
||||
},
|
||||
{
|
||||
name: '女'
|
||||
},
|
||||
{
|
||||
name: '保密'
|
||||
},
|
||||
],
|
||||
rules: {
|
||||
'userInfo.name': {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请填写姓名',
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
'userInfo.sex': {
|
||||
type: 'string',
|
||||
max: 1,
|
||||
required: true,
|
||||
message: '请选择男或女',
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
},
|
||||
radio: '',
|
||||
switchVal: false,
|
||||
});
|
||||
|
||||
// 使用 ref 创建响应式引用
|
||||
const formRef = ref(null);
|
||||
|
||||
// 定义方法
|
||||
function sexSelect(e) {
|
||||
state.model1.userInfo.sex = e.name;
|
||||
if (formRef.value) {
|
||||
formRef.value.validateField('userInfo.sex');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.content {
|
||||
padding: 20rpx;
|
||||
|
||||
.total {
|
||||
background-color: #50C758;
|
||||
border-radius: 16rpx 16rpx 16rpx 16rpx;
|
||||
color: white;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 42rpx 30rpx;
|
||||
font-size: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.action {
|
||||
background-color: white;
|
||||
border-radius: 16rpx 16rpx 16rpx 16rpx;
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.form {
|
||||
padding: 28rpx 30rpx;
|
||||
background-color: white;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
position: fixed;
|
||||
bottom: 146rpx;
|
||||
width: 710rpx;
|
||||
|
||||
|
||||
}
|
||||
</style>
|
|
@ -58,10 +58,17 @@
|
|||
v-model="item.price"></up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="status-png" v-if="tabIndex==2">
|
||||
<image :src="item.is_adopt?successPng:errPng" style="width: 108rpx; height: 84rpx;">
|
||||
<!-- <view class="status-png" v-if="tabIndex==2">
|
||||
<image v-if="is_storage==1 && is_adopt == 1" :src="waitPng"
|
||||
style="width: 108rpx; height: 84rpx;">
|
||||
</image>
|
||||
</view>
|
||||
<image v-else-if="is_storage==0 && is_adopt == 1" :src="waitPng"
|
||||
style="width: 108rpx; height: 84rpx;">
|
||||
</image>
|
||||
<image v-else :src="waitPng" style="width: 108rpx; height: 84rpx;">
|
||||
</image>
|
||||
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="card-footer" v-if="item.nums && item.price">
|
||||
共{{item.nums}}{{item.unit_name}} 合计:<text
|
||||
|
@ -114,7 +121,15 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="status-png" v-if="tabIndex==2">
|
||||
<image :src="item.is_adopt?successPng:errPng" style="width: 108rpx; height: 84rpx;">
|
||||
<!-- <image :src="item.is_adopt?successPng:errPng" style="width: 108rpx; height: 84rpx;">
|
||||
</image> -->
|
||||
<image v-if="is_storage==1 && is_adopt == 1" :src="successPng"
|
||||
style="width: 108rpx; height: 84rpx;">
|
||||
</image>
|
||||
<image v-else-if="is_storage==0 && is_adopt == 1" :src="errPng"
|
||||
style="width: 108rpx; height: 84rpx;">
|
||||
</image>
|
||||
<image v-else :src="waitPng" style="width: 108rpx; height: 84rpx;">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -160,6 +175,8 @@
|
|||
// 状态图片url
|
||||
const successPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/739c3202405071458553459.png')
|
||||
const errPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/04c2c202405071501462462.png')
|
||||
const waitPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/274ad202405111523222891.png')
|
||||
|
||||
// 状态图片url结束
|
||||
|
||||
|
||||
|
|
20
pages.json
20
pages.json
|
@ -110,6 +110,26 @@
|
|||
"navigationBarTitleText": "关于我们",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}, {
|
||||
"path": "Balance/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的余额",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "Balance/bindAccout",
|
||||
"style": {
|
||||
"navigationBarTitleText": "绑定账户",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "Balance/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "明细",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "feedBack/index",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -46,6 +46,7 @@
|
|||
<view class="card">
|
||||
<up-cell-group>
|
||||
<up-cell title="我的地址" :isLink="true" url="/pagesOrder/addressList/addressList"></up-cell>
|
||||
<up-cell title="我的余额" :isLink="true" url="/pageQuota/Balance/index"></up-cell>
|
||||
</up-cell-group>
|
||||
</view>
|
||||
|
||||
|
|
|
@ -1,275 +1,299 @@
|
|||
<template>
|
||||
<view class="wrap">
|
||||
<up-navbar placeholder style="z-index: 100800;" @leftClick="navBack">
|
||||
<template #center>
|
||||
<view>订单</view>
|
||||
</template>
|
||||
</up-navbar>
|
||||
<up-sticky bgColor="#fff">
|
||||
<view style="padding: 10rpx 20rpx 0 20rpx;">
|
||||
<up-search shape="round" v-model="keyword" @custom="searchOn" @search="searchOn" @clear="searchOn"
|
||||
:actionStyle="{color: '#20b128'}"></up-search>
|
||||
</view>
|
||||
<up-tabs :current="tabsActive" :list="tablist" lineColor="#20b128" :scrollable="false"
|
||||
:activeStyle=" { color: '#20b128', fontWeight: 'bold' }" @change="changeTab"></up-tabs>
|
||||
</up-sticky>
|
||||
<view class="wrap">
|
||||
<up-navbar placeholder style="z-index: 100800;" @leftClick="navBack">
|
||||
<template #center>
|
||||
<view>订单</view>
|
||||
</template>
|
||||
</up-navbar>
|
||||
<up-sticky bgColor="#fff">
|
||||
<view style="padding: 10rpx 20rpx 0 20rpx;">
|
||||
<up-search shape="round" v-model="keyword" @custom="searchOn" @search="searchOn" @clear="searchOn"
|
||||
:actionStyle="{color: '#20b128'}"></up-search>
|
||||
</view>
|
||||
<up-tabs :current="tabsActive" :list="tablist" lineColor="#20b128" :scrollable="false"
|
||||
:activeStyle=" { color: '#20b128', fontWeight: 'bold' }" @change="changeTab"></up-tabs>
|
||||
</up-sticky>
|
||||
|
||||
<swiper class="swiper-box" :current="swiperCurrent" @animationfinish="animationfinish">
|
||||
<swiper-item class="swiper-item" v-for="(list, k) in orderList" :key="k">
|
||||
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="loadMoreGood">
|
||||
<view class="page-box">
|
||||
<view v-if="list.length>0" class="list">
|
||||
<good v-for="(item, index) in list" :datas="item" :key="index" :type="k" @cancleOrder="cancleOrder"
|
||||
@takeOrder="takeOrder" @rePay="rePay" @purchaseAgain="purchaseAgain"></good>
|
||||
</view>
|
||||
<view v-if="!where[k].loading&&list.length==0" style="padding-top: 100rpx;">
|
||||
<up-empty text="订单空空如也"
|
||||
icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/29955202404260944367594.png">
|
||||
</up-empty>
|
||||
</view>
|
||||
<view v-else-if="where[k].loadend" style="padding-top: 100rpx;">
|
||||
<view style="text-align: center;color: #999;">没有更多了</view>
|
||||
</view>
|
||||
<view v-if="where[k].loading"
|
||||
style="padding-top: 100rpx;display: flex;flex-direction: column;align-items: center;">
|
||||
<up-loading-icon mode="circle"></up-loading-icon>
|
||||
<view style="margin-top: 20rpx;color: #999;">加载中</view>
|
||||
</view>
|
||||
<view style="width: 100%;height: 300rpx;"></view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<orderCanclePopup :show="showCancel" @close="showCancel=false" @change="submitCancel" />
|
||||
<modal :show="showTake" title="确认收货" content="请确认您已收到货" @close="showTake=false" @change="confirmReceipt"></modal>
|
||||
</view>
|
||||
<swiper class="swiper-box" :current="swiperCurrent" @animationfinish="animationfinish">
|
||||
<swiper-item class="swiper-item" v-for="(list, k) in orderList" :key="k">
|
||||
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="loadMoreGood">
|
||||
<view class="page-box">
|
||||
<view v-if="list.length>0" class="list">
|
||||
<good v-for="(item, index) in list" :datas="item" :key="index" :type="k"
|
||||
@cancleOrder="cancleOrder" @takeOrder="takeOrder" @rePay="rePay"
|
||||
@purchaseAgain="purchaseAgain"></good>
|
||||
</view>
|
||||
<view v-if="!where[k].loading&&list.length==0" style="padding-top: 100rpx;">
|
||||
<up-empty text="订单空空如也"
|
||||
icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/29955202404260944367594.png">
|
||||
</up-empty>
|
||||
</view>
|
||||
<view v-else-if="where[k].loadend" style="padding-top: 100rpx;">
|
||||
<view style="text-align: center;color: #999;">没有更多了</view>
|
||||
</view>
|
||||
<view v-if="where[k].loading"
|
||||
style="padding-top: 100rpx;display: flex;flex-direction: column;align-items: center;">
|
||||
<up-loading-icon mode="circle"></up-loading-icon>
|
||||
<view style="margin-top: 20rpx;color: #999;">加载中</view>
|
||||
</view>
|
||||
<view style="width: 100%;height: 300rpx;"></view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<orderCanclePopup :show="showCancel" @close="showCancel=false" @change="submitCancel" />
|
||||
<modal :show="showTake" title="确认收货" content="请确认您已收到货" @close="showTake=false" @change="confirmReceipt">
|
||||
</modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad, onUnload } from "@dcloudio/uni-app"
|
||||
import { ref } from 'vue';
|
||||
import good from "./component/good.vue";
|
||||
import orderCanclePopup from "@/components/orderCanclePopup.vue"
|
||||
import modal from "@/components/modal.vue"
|
||||
import { cancelOrderApi, rePaymentApi, confirmReceiptApi, orderListApi, purchaseAgainApi } from "@/api/order.js"
|
||||
import {
|
||||
onLoad,
|
||||
onUnload
|
||||
} from "@dcloudio/uni-app"
|
||||
import {
|
||||
ref
|
||||
} from 'vue';
|
||||
import good from "./component/good.vue";
|
||||
import orderCanclePopup from "@/components/orderCanclePopup.vue"
|
||||
import modal from "@/components/modal.vue"
|
||||
import {
|
||||
cancelOrderApi,
|
||||
rePaymentApi,
|
||||
confirmReceiptApi,
|
||||
orderListApi,
|
||||
purchaseAgainApi
|
||||
} from "@/api/order.js"
|
||||
|
||||
const tabsActive = ref(0)
|
||||
const changeTab = ({ index }) => {
|
||||
tabsActive.value = index;
|
||||
swiperCurrent.value = index;
|
||||
}
|
||||
const tablist = ref([
|
||||
{ name: '全部' },
|
||||
{ name: '待付款' },
|
||||
{ name: '待收货' },
|
||||
// { name: '退款/售后' },
|
||||
]);
|
||||
const tabsActive = ref(0)
|
||||
const changeTab = ({
|
||||
index
|
||||
}) => {
|
||||
tabsActive.value = index;
|
||||
swiperCurrent.value = index;
|
||||
}
|
||||
const tablist = ref([{
|
||||
name: '全部'
|
||||
},
|
||||
{
|
||||
name: '待付款'
|
||||
},
|
||||
{
|
||||
name: '待收货'
|
||||
},
|
||||
// { name: '退款/售后' },
|
||||
]);
|
||||
|
||||
const swiperCurrent = ref(0);
|
||||
const animationfinish = ({ detail: { current } }) => {
|
||||
swiperCurrent.value = current;
|
||||
tabsActive.value = current;
|
||||
if (swiperCurrent.value == 0 && orderList.value[0].length == 0) getOrderList(0);
|
||||
if (swiperCurrent.value == 1 && orderList.value[1].length == 0) getOrderList(1, '', 0);
|
||||
if (swiperCurrent.value == 2 && orderList.value[2].length == 0) getOrderList(2, 1);
|
||||
}
|
||||
const swiperCurrent = ref(0);
|
||||
const animationfinish = ({
|
||||
detail: {
|
||||
current
|
||||
}
|
||||
}) => {
|
||||
swiperCurrent.value = current;
|
||||
tabsActive.value = current;
|
||||
if (swiperCurrent.value == 0 && orderList.value[0].length == 0) getOrderList(0);
|
||||
if (swiperCurrent.value == 1 && orderList.value[1].length == 0) getOrderList(1, '', 0);
|
||||
if (swiperCurrent.value == 2 && orderList.value[2].length == 0) getOrderList(2, 1);
|
||||
}
|
||||
|
||||
// 取消订单
|
||||
const showCancel = ref(false);
|
||||
let cancelId = '';
|
||||
const submitCancel = (e) => {
|
||||
showCancel.value = false;
|
||||
cancelOrderApi({
|
||||
order_id: cancelId,
|
||||
value: e.value
|
||||
}).then(res => {
|
||||
uni.showToast({
|
||||
title: '取消成功',
|
||||
icon: 'none'
|
||||
})
|
||||
orderList.value[1] = orderList.value[1].filter(item => item.id !== cancelId)
|
||||
})
|
||||
}
|
||||
const cancleOrder = (e) => {
|
||||
cancelId = e.id;
|
||||
showCancel.value = true;
|
||||
}
|
||||
// 取消订单
|
||||
const showCancel = ref(false);
|
||||
let cancelId = '';
|
||||
const submitCancel = (e) => {
|
||||
showCancel.value = false;
|
||||
cancelOrderApi({
|
||||
order_id: cancelId,
|
||||
value: e.value
|
||||
}).then(res => {
|
||||
uni.showToast({
|
||||
title: '取消成功',
|
||||
icon: 'none'
|
||||
})
|
||||
orderList.value[1] = orderList.value[1].filter(item => item.id !== cancelId)
|
||||
})
|
||||
}
|
||||
const cancleOrder = (e) => {
|
||||
cancelId = e.id;
|
||||
showCancel.value = true;
|
||||
}
|
||||
|
||||
// 确认收货
|
||||
const showTake = ref(false);
|
||||
let takeId = "";
|
||||
const takeOrder = (e) => {
|
||||
takeId = e.id;
|
||||
showTake.value = true;
|
||||
}
|
||||
const confirmReceipt = () => {
|
||||
confirmReceiptApi({
|
||||
order_id: takeId
|
||||
}).then(res => {
|
||||
showTake.value = false;
|
||||
uni.$u.toast('确认收货成功');
|
||||
reloadAll();
|
||||
})
|
||||
}
|
||||
// 确认收货
|
||||
const showTake = ref(false);
|
||||
let takeId = "";
|
||||
const takeOrder = (e) => {
|
||||
takeId = e.id;
|
||||
showTake.value = true;
|
||||
}
|
||||
const confirmReceipt = () => {
|
||||
confirmReceiptApi({
|
||||
order_id: takeId
|
||||
}).then(res => {
|
||||
showTake.value = false;
|
||||
uni.$u.toast('确认收货成功');
|
||||
reloadAll();
|
||||
})
|
||||
}
|
||||
|
||||
// 再次购买
|
||||
const purchaseAgain = (e) => {
|
||||
purchaseAgainApi({
|
||||
order_id: e.id
|
||||
}).then(res => {
|
||||
uni.$u.toast('已加入购物车');
|
||||
})
|
||||
}
|
||||
// 再次购买
|
||||
const purchaseAgain = (e) => {
|
||||
purchaseAgainApi({
|
||||
order_id: e.id
|
||||
}).then(res => {
|
||||
uni.$u.toast('已加入购物车');
|
||||
})
|
||||
}
|
||||
|
||||
const rePay = (e) => {
|
||||
rePaymentApi({
|
||||
order_id: e.id,
|
||||
address_id: e.address_id,
|
||||
mer_id: e.merchant,
|
||||
pay_type: 1
|
||||
}).then(res => {
|
||||
if (!res.data?.nonceStr) return uni.$u.toast('支付失败!');
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
timeStamp: res.data.timeStamp,
|
||||
nonceStr: res.data.nonceStr,
|
||||
package: res.data.package,
|
||||
signType: res.data.signType,
|
||||
paySign: res.data.paySign,
|
||||
success: (e) => {
|
||||
if (e.errMsg == 'requestPayment:ok') {
|
||||
uni.showToast({
|
||||
title: '订单支付成功',
|
||||
icon: 'success'
|
||||
})
|
||||
reloadAll();
|
||||
} else uni.$u.toast('支付失败')
|
||||
},
|
||||
fail: (e) => {
|
||||
uni.$u.toast('用户取消支付')
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.$u.toast('网络错误')
|
||||
})
|
||||
}
|
||||
const rePay = (e) => {
|
||||
rePaymentApi({
|
||||
order_id: e.id,
|
||||
address_id: e.address_id,
|
||||
mer_id: e.merchant,
|
||||
pay_type: 1
|
||||
}).then(res => {
|
||||
if (!res.data?.nonceStr) return uni.$u.toast('支付失败!');
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
timeStamp: res.data.timeStamp,
|
||||
nonceStr: res.data.nonceStr,
|
||||
package: res.data.package,
|
||||
signType: res.data.signType,
|
||||
paySign: res.data.paySign,
|
||||
success: (e) => {
|
||||
if (e.errMsg == 'requestPayment:ok') {
|
||||
uni.showToast({
|
||||
title: '订单支付成功',
|
||||
icon: 'success'
|
||||
})
|
||||
reloadAll();
|
||||
} else uni.$u.toast('支付失败')
|
||||
},
|
||||
fail: (e) => {
|
||||
uni.$u.toast('用户取消支付')
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.$u.toast('网络错误')
|
||||
})
|
||||
}
|
||||
|
||||
// 订单
|
||||
const where = ref([{
|
||||
page_no: 1,
|
||||
page_size: 25,
|
||||
loading: false,
|
||||
loadend: false
|
||||
}, {
|
||||
page_no: 1,
|
||||
page_size: 25,
|
||||
loading: false,
|
||||
loadend: false
|
||||
},
|
||||
{
|
||||
page_no: 1,
|
||||
page_size: 25,
|
||||
loading: false,
|
||||
loadend: false
|
||||
}
|
||||
])
|
||||
const keyword = ref('')
|
||||
const orderList = ref([
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
])
|
||||
const getOrderList = (type = 0, status = '', paid = 1) => {
|
||||
if (where.value[type].loadend) return;
|
||||
where.value[type].loading = true;
|
||||
orderListApi({
|
||||
page_no: where.value[type].page_no,
|
||||
page_size: where.value[type].page_size,
|
||||
number: keyword.value,
|
||||
status: status,
|
||||
paid: paid
|
||||
}).then(res => {
|
||||
if (where.value[type].page_no == 1) orderList.value[type] = [];
|
||||
orderList.value[type] = [...orderList.value[type], ...res.data.lists];
|
||||
if (res.data.lists.length < where.value[type].page_size) where.value[type].loadend = true;
|
||||
where.value[type].page_no++;
|
||||
where.value[type].loading = false;
|
||||
}).catch(err => {
|
||||
where.value[type].loading = false;
|
||||
})
|
||||
}
|
||||
// 订单
|
||||
const where = ref([{
|
||||
page_no: 1,
|
||||
page_size: 25,
|
||||
loading: false,
|
||||
loadend: false
|
||||
}, {
|
||||
page_no: 1,
|
||||
page_size: 25,
|
||||
loading: false,
|
||||
loadend: false
|
||||
},
|
||||
{
|
||||
page_no: 1,
|
||||
page_size: 25,
|
||||
loading: false,
|
||||
loadend: false
|
||||
}
|
||||
])
|
||||
const keyword = ref('')
|
||||
const orderList = ref([
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
])
|
||||
const getOrderList = (type = 0, status = '', paid = 1) => {
|
||||
if (where.value[type].loadend) return;
|
||||
where.value[type].loading = true;
|
||||
orderListApi({
|
||||
page_no: where.value[type].page_no,
|
||||
page_size: where.value[type].page_size,
|
||||
number: keyword.value,
|
||||
status: status,
|
||||
paid: paid
|
||||
}).then(res => {
|
||||
if (where.value[type].page_no == 1) orderList.value[type] = [];
|
||||
orderList.value[type] = [...orderList.value[type], ...res.data.lists];
|
||||
if (res.data.lists.length < where.value[type].page_size) where.value[type].loadend = true;
|
||||
where.value[type].page_no++;
|
||||
where.value[type].loading = false;
|
||||
}).catch(err => {
|
||||
where.value[type].loading = false;
|
||||
})
|
||||
}
|
||||
|
||||
const loadMoreGood = () => {
|
||||
if (swiperCurrent.value == 0) getOrderList(0);
|
||||
if (swiperCurrent.value == 1) getOrderList(1, '', 0);
|
||||
if (swiperCurrent.value == 2) getOrderList(2, 1);
|
||||
}
|
||||
const loadMoreGood = () => {
|
||||
if (swiperCurrent.value == 0) getOrderList(0);
|
||||
if (swiperCurrent.value == 1) getOrderList(1, '', 0);
|
||||
if (swiperCurrent.value == 2) getOrderList(2, 1);
|
||||
}
|
||||
|
||||
// 搜索
|
||||
const searchOn = () => {
|
||||
orderList.value[+swiperCurrent.value] = [];
|
||||
where.value[+swiperCurrent.value].page_no = 1;
|
||||
where.value[+swiperCurrent.value].loadend = false;
|
||||
if (swiperCurrent.value == 0) getOrderList(0);
|
||||
if (swiperCurrent.value == 1) getOrderList(1, '', 0);
|
||||
if (swiperCurrent.value == 2) getOrderList(2, 1);
|
||||
}
|
||||
// 搜索
|
||||
const searchOn = () => {
|
||||
orderList.value[+swiperCurrent.value] = [];
|
||||
where.value[+swiperCurrent.value].page_no = 1;
|
||||
where.value[+swiperCurrent.value].loadend = false;
|
||||
if (swiperCurrent.value == 0) getOrderList(0);
|
||||
if (swiperCurrent.value == 1) getOrderList(1, '', 0);
|
||||
if (swiperCurrent.value == 2) getOrderList(2, 1);
|
||||
}
|
||||
|
||||
let back = 0;
|
||||
const navBack = () => {
|
||||
uni.navigateBack({
|
||||
delta: back ? +back : 0
|
||||
})
|
||||
}
|
||||
let back = 0;
|
||||
const navBack = () => {
|
||||
uni.navigateBack({
|
||||
delta: back ? +back : 0
|
||||
})
|
||||
}
|
||||
|
||||
const reloadAll = () => { //对订单进行操作时刷新页面
|
||||
where.value.forEach(item => {
|
||||
item.page_no = 1;
|
||||
item.loadend = false;
|
||||
});
|
||||
getOrderList(1, '', 0);
|
||||
getOrderList(0);
|
||||
getOrderList(2, 1);
|
||||
}
|
||||
const reloadAll = () => { //对订单进行操作时刷新页面
|
||||
where.value.forEach(item => {
|
||||
item.page_no = 1;
|
||||
item.loadend = false;
|
||||
});
|
||||
getOrderList(1, '', 0);
|
||||
getOrderList(0);
|
||||
getOrderList(2, 1);
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.type) {
|
||||
tabsActive.value = +options.type;
|
||||
swiperCurrent.value = +options.type;
|
||||
searchOn();
|
||||
}
|
||||
if (options.back) back = options.back;
|
||||
// getOrderList(0);
|
||||
// getOrderList(1, '', 0);
|
||||
// getOrderList(2, 1);
|
||||
onLoad((options) => {
|
||||
if (options.type) {
|
||||
tabsActive.value = +options.type;
|
||||
swiperCurrent.value = +options.type;
|
||||
searchOn();
|
||||
}
|
||||
if (options.back) back = options.back;
|
||||
// getOrderList(0);
|
||||
// getOrderList(1, '', 0);
|
||||
// getOrderList(2, 1);
|
||||
|
||||
uni.$on('reLoadOrderList', reloadAll);
|
||||
})
|
||||
uni.$on('reLoadOrderList', reloadAll);
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
uni.$off('reLoadOrderList', reloadAll)
|
||||
})
|
||||
onUnload(() => {
|
||||
uni.$off('reLoadOrderList', reloadAll)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: calc(100vh - var(--window-top));
|
||||
width: 100%;
|
||||
}
|
||||
.wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: calc(100vh - var(--window-top));
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.swiper-box {
|
||||
flex: 1;
|
||||
}
|
||||
.swiper-box {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.swiper-item {
|
||||
height: 100%;
|
||||
}
|
||||
.swiper-item {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.page-box {
|
||||
margin: 20rpx;
|
||||
.page-box {
|
||||
margin: 20rpx;
|
||||
|
||||
.list {}
|
||||
}
|
||||
// .list {}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue