This commit is contained in:
2025-06-16 10:09:19 +08:00
commit 7a066b3026
428 changed files with 50385 additions and 0 deletions

161
pages/points-mall/buy.vue Normal file
View File

@ -0,0 +1,161 @@
<template>
<view >
<i-loading v-if="loading || address_loading"></i-loading>
<view class="flex align-center justify-center bg-white p-3" @click="toAddress" v-if="!address_id">
<view class="text-center">
<uni-icons type="plusempty" size="20" color="#999999"></uni-icons>
<view class="text-muted font28 mt-2">请选择收货地址</view>
</view>
</view>
<view class="bg-white p-3 flex align-center" @click="toAddress" v-else>
<uni-icons type="location" size="20" color="#333333"></uni-icons>
<view class="flex-1 mx-2">
<view class="flex align-center font32">
<text>{{address.user_name}}</text>
<text class="ml-3">{{address.user_phone}}</text>
</view>
<view class="mt-1 font30 line15">{{address.region_prov}}{{address.region_city}}{{address.region_area}}{{address.region_addr}}</view>
</view>
<uni-icons type="right" size="16" color="#999999"></uni-icons>
</view>
<view class=" mt-2 bg-white">
<view class="flex align-center justify-between p-3 border-bottom">
<text class="font28 text-muted">订单编号</text>
<view class="">{{order.order_no}}</view>
</view>
</view>
<view class=" mt-2 bg-white">
<view class="flex align-center justify-between p-3 border-bottom">
<text class="font28 text-muted">商品积分</text>
<view class="cny_jf font-weight-bold">{{order.amount_goods}}</view>
</view>
</view>
<view class="mt-2 bg-white p-3" v-if="false">
<view class="font30 mr-2">备注信息</view>
<textarea placeholder="请输入备注信息" class="font30 mt-2 w-100" style="height: 100rpx;"></textarea>
</view>
<view class="cu-tabbar-height"></view>
<view class="fixed-bottom bg-white py-2 border-top">
<view class="flex align-center justify-between px-3">
<view class="flex align-center font32">
<text class="text-muted">消耗</text>
<view class="cny_jf font-weight-bold">{{order.amount_total}}</view>
</view>
<view class="bg-danger text-white px-4 rounded-circle py-2 font30" @click="toPay">立即兑换</view>
</view>
</view>
</view>
</template>
<script>
import { TaAjax } from '../../common/ajax'
export default {
data() {
return {
address_loading: false,
address_id: 0,
address: {},
loading: false,
order_no: "",
order: {},
}
},
onLoad(e) {
this.order_no = e.order_no
if (!this.order_no) {
uni.showToast({
title: '参数错误',
icon: 'none',
complete() {
uni.navigateBack()
}
})
}
this.address_id = e.address_id
if (this.address_id) {
this.loadAddress()
}
this.loadData()
},
methods: {
loadData() {
this.loading = true
TaAjax.get('/points_mall/api.auth.order/get', {
order_no: this.order_no,
}).then(res => {
const data = res.data
this.order = data.list[0]
}).finally(() => {
this.loading = false
})
},
loadAddress() {
this.address_loading = true
TaAjax.get('/points_mall/api.auth.address/info', {
id: this.address_id,
}).then(res => {
this.address = res.data
}).finally(() => {
this.address_loading = false
})
},
toPay(){
if (!this.address_id) {
return uni.showToast({
title: '请选择收货地址',
icon: 'none',
})
}
uni.showLoading({
title: '兑换中',
})
TaAjax.post('/points_mall/api.auth.order/perfect', {
order_no: this.order_no,
address_id: this.address_id,
}).then(res => {
if (res.code == 1) {
TaAjax.post('/points_mall/api.auth.order/payment', {
order_no: this.order_no,
}).then(payRes => {
if (payRes.code == 1) {
uni.hideLoading()
uni.showToast({
title: "兑换成功",
icon: 'success',
})
} else {
uni.hideLoading()
uni.showToast({
title: payRes.info,
icon: 'error',
})
}
})
} else {
uni.hideLoading()
uni.showToast({
title: res.info,
icon: 'error',
})
}
}).catch(err => {
uni.hideLoading()
uni.showToast({
title: "网络异常",
icon: 'none',
})
})
},
toAddress(){
uni.redirectTo({
url:'/pages/user/address?order_no='+this.order_no
})
},
}
}
</script>
<style>
</style>

View File

@ -0,0 +1,111 @@
<template>
<view>
<i-swiper :resdata="piclist" :width="750" :height="750" :round='false' />
<view class="bg-white p-3">
<view class="flex align-center">
<!-- <text class="d-inline-block bg-danger font20 text-white px-1 line2 rounded mr-1">秒杀</text> -->
<view class="flex-1 text-ellipsis-1 font32">{{goodsInfo.name}}</view>
</view>
<view class=" flex align-end mt-2">
<view class="text-danger">
<text class="cny_jf">{{goodsInfo.price_selling}}</text>
</view>
<view class="font24 text-through cny ml-2 text-muted">{{goodsInfo.price_market}}</view>
</view>
</view>
<view class="mt-2 bg-white p-3">
<view class="font32 font-weight-bold">图文详情</view>
<i-spread width="690rpx" height="2000rpx" :isShrink="true">
<u-parse :content="goodsInfo.content" @preview="preview" @navigate="navigate"></u-parse>
</i-spread>
</view>
<view class="cu-tabbar-height"></view>
<view class="bg-white fixed-bottom">
<view class=" px-2 py-1 border-top flex align-center">
<view class="flex-1 flex align-center ">
<view class="text-center flex-1" @click="toIndex">
<uni-icons type="home" size="20" color="#333333"></uni-icons>
<view class="font24">首页</view>
</view>
</view>
<view class="flex-2 flex align-center ml-2">
<view class="bg-danger text-white text-center py-2 font30 line15 rounded-circle flex-1" @click="toEvaluate">立即兑换</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { TaAjax } from '../../common/ajax';
export default {
data() {
return {
code: 0,
goodsInfo: {},
piclist: [],
}
},
onLoad(e) {
this.code = e.code
if (!this.code) {
uni.showToast({
title: '参数错误',
icon: 'none',
duration: 2000,
complete() {
uni.navigateBack({
delta: 1,
})
}
})
}
},
onShow() {
this.loadData()
},
methods: {
loadData() {
TaAjax.get('/points_mall/api.goods/get', {
code: this.code
}).then((result) => {
const data = result.data;
const data_list = data.list;
this.goodsInfo = data_list[0];
this.piclist = this.goodsInfo.slider
}).catch((e) => {
console.warn(e)
}).finally(() => {
});
},
toIndex(){
uni.switchTab({
url:'/pages/points-mall/index'
})
},
toEvaluate(){
uni.showLoading({
title: '加载中',
})
TaAjax.post('/points_mall/api.auth.order/add_goods', {
code: this.code
}).then((result) => {
const data = result.data;
const order_no = data.order_no;
uni.navigateTo({
url:'/pages/points-mall/buy?order_no='+order_no
})
}).finally(() => {
uni.hideLoading()
});
},
}
}
</script>
<style scoped>
.bg-light-danger {
background-color: #fad8d6;
}
</style>

View File

@ -0,0 +1,82 @@
<template>
<view class="flex flex-column" style="width:100vw;height: 100vh;">
<i-loading v-if="loading" />
<view class="flex flex-column flex-1">
<scroll-view class="flex-1" :scroll-y="true" :refresher-enabled="true"
:refresher-triggered="refresh" @refresherrefresh="refreshData" @scrolltolower="loadData">
<view class="px-2">
<i-list-top :resdata="goodsList"></i-list-top>
</view>
<uni-load-more :status="more_status" @clickLoadMore="loadData"></uni-load-more>
</scroll-view>
</view>
</view>
</template>
<script>
import { TaAjax } from '../../common/ajax';
export default {
computed: {
more_status() {
if (this.finish) {
return 'no-more';
} else if (this.loading) {
return 'loading';
} else {
return 'more';
}
},
},
data() {
return {
goodsList: [],
curPage: 1,
loading: true,
refresh: true,
finish: false
}
},
methods: {
loadData() {
if (this.refresh) {
this.goodsList.length = 0;
this.finish = false;
}
if (this.finish) {
return;
}
this.loading = true;
TaAjax.get('/points_mall/api.goods/get', {
page: this.curPage
}).then((result) => {
const data = result.data;
const data_list = data.list;
if (this.refresh) {
this.goodsList.length = 0;
}
this.goodsList = this.goodsList.concat(data_list);
this.finish = data.total <= this.goodsList.length;
this.curPage++;
}).catch((e) => {
console.warn(e)
if (this.goodsList.length == 0) {
this.finish = true;
}
}).finally(() => {
this.refresh = false;
this.loading = false;
});
},
refreshData() {
this.finish = false;
this.refresh = true;
this.curPage = 1;
this.loadData();
},
}
}
</script>
<style>
</style>