抽奖列表,兑换列表调试

This commit is contained in:
GaoHao 2024-12-23 10:32:42 +08:00
parent 7c339bc617
commit c719ce1f27
3 changed files with 121 additions and 34 deletions

View File

@ -177,8 +177,9 @@
},
toGift() {
console.log('1');
uni.navigateTo({
url: '/me/gift/gift'
url: '/me/gift/gift?source='+this.source
})
},
//

View File

@ -2,11 +2,20 @@
<view class="min-page bg-gray u-font-28">
<view class="block bg-fff border-r-18 default-box-padding">
<view>
<view>兑换账号</view>
<view>中奖用户手机号</view>
<view class="border u-m-t-24 u-p-l-24" style="margin-bottom: 20rpx;">
<u-input v-model="query.phone" type="number" maxlength="11" placeholder="请输入中奖用户手机号"></u-input>
</view>
<view>收货地址</view>
<view class="border u-m-t-24 u-p-l-24" style="margin-bottom: 20rpx;">
<u-input v-model="query.address" type="text" placeholder="请输入收货地址"></u-input>
</view>
<view>备注</view>
<view class="border u-m-t-24 u-p-l-24">
<u-input type="text" placeholder="请输入兑换账号"></u-input>
<u-input v-model="query.remark" type="text" placeholder="请输入备注"></u-input>
</view>
</view>
<view class="u-m-t-48">
<view>兑换事项</view>
<view class="u-m-t-16 color-999">
@ -15,7 +24,7 @@
</view>
</view>
<view class="u-flex u-row-center">
<view class="btn-circle duihuan">确认兑换</view>
<view class="btn-circle duihuan" @click="exchange">确认兑换</view>
</view>
</view>
</template>
@ -24,11 +33,44 @@
export default {
data() {
return {
query: {
discSpinningRecordId: null,
source: 1,
phone: "",
address: "",
remark: "",
},
}
},
onLoad(options) {
console.log(options)
if ( options.id ) {
this.query.discSpinningRecordId = options.id
}
if ( options.source ) {
this.query.source = options.source
}
},
methods: {
exchange(){
let url = ""
if ( !this.query.phone ) {
uni.showToast({ title: '请输入中奖用户手机号', icon: 'none' });
return;
}
if ( !this.query.address ) {
uni.showToast({ title: '请输入中奖用户地址', icon: 'none' });
return;
}
this.$Request.postJson("app/userPrizeExchange/exchange", this.query).then(res => {
if (res.code == 0 ) {
uni.navigateBack()
} else {
uni.showToast({ title: res.msg, icon: 'none' });
}
})
},
}
}
</script>

View File

@ -4,6 +4,13 @@
<view class="gift-bg">
</view>
<view class="list">
<view class="tab">
<view class="tab_item"
:class="{active: item.type == tabIndex}"
@click="tabClick(item)"
v-for="(item,index) in tab" :key="index"
>{{item.label}}</view>
</view>
<view class="item" v-for="(item,index) in list" :key="index">
<view class="color-666 u-font-24">中奖时间 2024-09-11 10:20:11</view>
<view class="u-m-t-24 u-flex u-row-between">
@ -15,13 +22,13 @@
</view>
</view>
<view class="">
<view class="btn-circle duihuan" @click="toDuiHuan">立即兑换</view>
<view class="btn-circle duihuan" @click="toDuiHuan(item)">立即兑换</view>
<!-- <view class="btn-circle duihuan finish">已完成</view> -->
</view>
</view>
</view>
<view class="u-p-t-30 u-p-b-30 empty" v-if="hasAjax&&!list.length">
<u-empty text="暂无奖品" src="/static/icon-empty.svg"></u-empty>
<u-empty text="暂无记录" src="/static/icon-empty.svg"></u-empty>
</view>
</view>
<!-- <view class="u-p-30">
@ -37,45 +44,69 @@
background: {
backgroundColor: 'transparent'
},
tab: [{label: '抽奖记录', type: 1},{label: '兑换记录', type: 2}],
tabIndex: 1,
query: {
page: 10,
limit: 1,
source: 1,
},
total: 0,
status: 'nomore',
hasAjax:true,
source:null,
list:[]
}
},
methods: {
toDuiHuan(){
uni.navigateTo({
url:'/me/gift/duihuan'
})
},
init(){
if (this.source) {
this.query.source = this.source
}
this.$Request.getT('app/discSpinningRecord/selectDiscSpinningRecord', this.query).then(res => {
if (res.code == 0 ) {
this.list = res.data.records
}
})
onLoad(options) {
if ( options.source ) {
this.query.source = options.source
}
},
onLoad(options) {
console.log('onShow');
if ( options.source ) {
this.source = options.source
}
this.init()
onShow() {
this.getList()
},
methods: {
toDuiHuan(item){
uni.navigateTo({
url:`/me/gift/duihuan?source=${this.query.source}&id=${item.id}`
})
},
tabClick(item){
this.list = [];
this.tabIndex = item.type;
this.getList()
},
getList(){
let url = ""
if ( this.tabIndex == 1) {
url = "app/discSpinningRecord/selectDiscSpinningRecord"
} else {
url = "/app/userPrizeExchange/page"
}
this.$Request.getT(url, this.query).then(res => {
if (res.code == 0 ) {
if ( this.tabIndex == 1) {
this.list = res.data.records
this.total = res.data.total
} else {
this.list = res.page.list
this.total = res.page.totalCount
}
}
})
},
onReachBottom: function () {
if (this.page * this.limit < this.total) {
this.page = this.page + 1;
this.getList();
}
},
}
}
</script>
<style lang="scss" scoped>
.duihuan {
background: linear-gradient(87deg, #ED8087 0%, #ECA2AA 100%);
font-size: 24rpx;
@ -122,10 +153,23 @@
border-radius: 18rpx 18rpx 18rpx 18rpx;
overflow: hidden;
background-color: #fff;
padding: 0 24rpx;
.tab{
display: flex;
.tab_item{
height: 80rpx;
line-height: 80rpx;
width: 50%;
text-align: center;
font-size: 32rpx;
color: #333;
}
.tab_item.active{
background-color: #ECA2AA;
color: #fff;
}
}
.item {
padding: 32rpx 0;
padding: 32rpx 24rpx;
border-bottom: 1rpx solid #E5E5E5;
}
}