Commit 978c07ef by 李伟康

提交接龙

1 parent 839af115
......@@ -38,5 +38,32 @@ module.exports = {
projectName,
...data
})
},
/**分页获取用户红包中奖记录 */
getRedEnvelopeRecordList(data = {}) {
return api.post({
method: 'marketing.api.activityRedEnvelope.user.winning.goods.record.page',
projectName,
pageSize: 10,
...data
})
},
/**
* 快递到家地址信息配置列表
*/
getDeliveryConfig(data = {}) {
return api.post({
method: 'marketing.api.self.red.envelope.customer.write.config.list',
projectName,
...data
})
},
submitDelivery(data) {
return api.post({
method: 'marketing.api.self.red.envelope.customer.write.detail.save',
projectName,
...data
}, true)
}
}
\ No newline at end of file
// packageActivity/pages/redEnvelope/record/components/DeliveryBox/DeliveryBox.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
deliveryConfig: {
type: Object,
observer: function (n) {
if (!n.awardInfoId) return
const {
awardInfoId,
writeInfoList
} = n,
writeDetailList = [],
list = []
writeInfoList.map(({
describeId,
describeMsg
}) => {
writeDetailList.push({
describeId,
describeMsg,
detail: ''
})
let maxlength = 50,
type = 'text'
if (describeId == 2) {
maxlength = 11
type = 'tel'
}
if (describeId == 3) {
maxlength = 18
type = 'digit'
}
list.push({
maxlength,
type,
detail: '',
placeholder: `请输入${describeMsg}`
})
})
this.setData({
list,
params: {
awardInfoId,
writeDetailList
}
})
}
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
onChange(e) {
// e.detail 为当前输入的值
const {
index
} = e.currentTarget.dataset
this.setData({
[`list[${index}].detail`]: e.detail
})
},
close() {
this.setData({
show: false
})
this.triggerEvent('close')
},
submit() {
try {
const {
params,
list
} = this.data
list.map(({
detail,
placeholder
}, index) => {
if (detail) params.writeDetailList[index].detail = detail
else throw placeholder
})
this.close()
this.triggerEvent('submit', params)
} catch (error) {
if (error) wx.p.wxApi.showToast(error)
}
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {
"van-overlay": "@vant/weapp/overlay/index",
"van-field": "@vant/weapp/field/index"
}
}
\ No newline at end of file
/* packageActivity/pages/redEnvelope/record/components/DeliveryBox/DeliveryBox.wxss */
.delivery-box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
display: flex;
align-items: center;
width: 590rpx;
max-height: 800rpx;
background-image: linear-gradient(160deg, #ffc59c 12%, #fff0e6 100%);
box-shadow: 0 0 28rpx 4rpx #fff08ab3;
border-radius: 44rpx;
flex-direction: column;
padding: 64rpx 0 88rpx;
box-sizing: border-box;
.title {
font-weight: 600;
font-size: 40rpx;
color: #863e00;
padding-bottom: 32rpx;
}
.delivery-content {
width: 100%;
box-sizing: border-box;
padding: 0 48rpx;
max-height: 428rpx;
overflow-y: scroll;
.delivery-item {
height: 92rpx;
background: #ffffff;
border-radius: 16rpx;
margin-bottom: 20rpx;
overflow: hidden;
}
}
.btn {
margin-top: 52rpx;
width: 312rpx;
height: 80rpx;
background-image: linear-gradient(88deg, #ff444d 16%, #ff5ba8 90%);
border: 2rpx solid #ff7887;
box-shadow: inset 0 4rpx 24rpx 0 #ffffff80;
border-radius: 50rpx;
font-weight: 600;
font-size: 40rpx;
color: #ffffff;
text-align: center;
line-height: 80rpx;
}
.close{
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: -114rpx;
width: 72rpx;
height: 72rpx;
}
}
<van-overlay show="{{ show }}" lock-scroll="{{false}}">
<view class="delivery-box show-view">
<view class="title">填写信息</view>
<view class="delivery-content">
<block wx:for="{{list}}" wx:key="index">
<view class="delivery-item">
<van-field value="{{item.detail}}" type="{{item.type}}" maxlength="{{item.maxlength}}" placeholder="{{item.placeholder}}" bindchange="onChange" data-index="{{index}}" />
</view>
</block>
</view>
<view class="btn" bindtap="submit">确认提交</view>
<view class="close" bindtap="close">
<glsx-image src="activity/close.png"></glsx-image>
</view>
</view>
</van-overlay>
\ No newline at end of file
......@@ -5,17 +5,108 @@ Page({
* 页面的初始数据
*/
data: {
list: [],
pageNum: 1,
},
onClickHide() {
this.setData({ show: !this.data.show })
open(e) {
const {
code
} = e.currentTarget.dataset
this.setData({
showCodeBox: true,
codeNumber: code
})
},
close() {
this.setData({
showCodeBox: false
})
},
/**
* 状态
* 1-提现中;2-提现成功;3-提现失败;(红包状态)
* 4-已到账;5-未到账;(劵状态)
* 6-待核销;7-已核销;8-待发货;9-已发货;(实物)
*
* isAddressFlag 奖品是否已填写收货地址 true:是; false:否;
*/
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getList()
},
async getList() {
try {
wx.p.wxApi.showLoading()
const {
list,
pageNum
} = this.data, {
list: data,
total
} = await wx.p.api.solitaireApi.getRedEnvelopeRecordList({
pageNum
})
this.setData({
list: [...list, ...data],
total
})
wx.hideLoading()
} catch (error) {
wx.hideLoading()
if (error) wx.p.wxApi.showToast(String(error))
}
},
writeDelivery(e) {
const {
awardInfoId
} = e.currentTarget.dataset
wx.p.api.solitaireApi.getDeliveryConfig({
awardInfoId
}).then(async writeInfoList => {
this.setData({
deliveryConfig: {
writeInfoList,
awardInfoId,
},
showDeliveryBox: true
})
})
},
async submitDelivery({
detail
}) {
try {
wx.p.wxApi.showLoading('提交中...')
const {
code,
message
} = await wx.p.api.solitaireApi.submitDelivery(detail)
wx.hideLoading()
if (code == 0) {
this.setData({
pageNum: 1,
list: [],
deliveryConfig: {},
})
wx.p.wxApi.showToast('提交成功!')
setTimeout(() => {
this.getList()
}, 1.5e3)
} else throw message
} catch (error) {
console.log(error)
wx.hideLoading()
if (error) wx.p.wxApi.showToast(error)
}
},
closeDelivery() {
this.setData({
deliveryConfig: {},
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
......@@ -55,7 +146,18 @@ Page({
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let {
pageNum,
total
} = this.data
wx.p.util.onReachBottom({
pageNum,
total
},
() => {
this.getList()
}
)
},
/**
......
{
"usingComponents": {
"van-overlay": "@vant/weapp/overlay/index"
"van-overlay": "@vant/weapp/overlay/index",
"delivery-box":"./components/DeliveryBox/DeliveryBox"
},
"navigationBarTitleText": "中奖记录"
}
\ No newline at end of file
......@@ -21,6 +21,18 @@ page {
top: 20rpx;
font-weight: 500;
color: #52C41A;
&-1,
&-6,
&-8 {
color: #ff9909;
}
&-3,
&-5,
&-7 {
color: #999999;
}
}
.icon {
......
<view class="layout isFullSucreen">
<block wx:for="{{10}}" wx:key="index">
<block wx:for="{{list}}" wx:key="index">
<view class="item flex">
<view class="status">提现成功</view>
<view class="status status-{{item.status}}">{{item.statusStr}}</view>
<view class="icon">
<image src="https://wx.glsx.com.cn/upload/biz/65872118-dd49-425a-a59a-18a1191c107e.jpeg" />
<image src="{{item.prizeLogo}}" />
</view>
<view class="info">
<view class="name">先试试</view>
<view class="price">
<view class="unit">¥</view>
8.88
</view>
<view class="time">2023-12-12 12:30:29</view>
<view class="name">{{item.prizeName}}</view>
<block wx:if="{{item.prizeType == 0}}">
<view class="price">
<view class="unit">¥</view>
{{item.amount}}
</view>
</block>
<view class="time">{{item.winTime}}</view>
</view>
<view class="btn text-center" bindtap="onClickHide">查看</view>
<block wx:if="{{item.prizeType == 1 && item.status == 5}}">
<view class="btn text-center" data-code="{{item.code}}" bindtap="open">查看</view>
</block>
<block wx:if="{{item.exchangeType == 0 && item.status == 8 && !item.isAddressFlag}}">
<view class="btn text-center" data-award-info-id="{{item.awardInfoId}}" bindtap="writeDelivery">填写</view>
</block>
</view>
</block>
<block wx:if="{{nothing}}">
<view class="list-nothing ">到底啦!!</view>
</block>
</view>
<van-overlay show="{{ show }}" >
<van-overlay show="{{ showCodeBox }}">
<view class="code-box flex">
<view class="content flex">
<view class="title">核销码</view>
<view class="code">134226</view>
<view class="code">{{codeNumber}}</view>
<view class="tips text-center">核销码用于到店核销领取奖品</view>
</view>
<view class="close" bindtap="onClickHide">
<view class="close" bindtap="close">
<glsx-image src="activity/close.png"></glsx-image>
</view>
</view>
</van-overlay>
\ No newline at end of file
</van-overlay>
<delivery-box deliveryConfig="{{deliveryConfig}}" model:show="{{showDeliveryBox}}" bindsubmit="submitDelivery" bindclose="closeDelivery"></delivery-box>
\ No newline at end of file
......@@ -21,7 +21,6 @@ Page({
onLoad(options) {
this.setData({
popupTitle: '接龙时间已截止!'
//此群无法进行接龙游戏!
})
},
......@@ -60,18 +59,19 @@ Page({
encryptedData
})
if (code == 0 && data) {
console.log(data, '------')
console.log('openGid:', data)
const res = await wx.p.api.userApi.openGIdtoChatId({
merchantId: options.merchantId,
openGid: 'GtsOh6zJoHmautQCAxaxaUzIxYNo' || data
})
console.log('chatId:', res.data)
options.chatId = res.data || ''
this.options = options
_this.getSolitaireUserInfo(options)
} else throw message
},
fail() {
throw '获取群聊ID失败'
fail(err) {
_this.getSolitaireUserInfo(options)
}
})
} catch (error) {
......@@ -103,7 +103,15 @@ Page({
if (code == 0) {
this.getSolitaireDetail(params)
if (data) {
//已参加 或 已结束
/**
* stateCode 状态码 -1.未参与 0.已参加 1.未中奖 2.已中奖
* relayContent 接龙内容
*/
if(data.stateCode == 1) this.setData({
popupType: 2,
show: true,
disabled: true
})
// const {
// relayContent,
// stateCode,
......@@ -132,13 +140,22 @@ Page({
try {
wx.p.wxApi.showLoading()
const res = await wx.p.api.solitaireApi.getSolitaireDetail(params)
res.groupLimitOpen = true
if (res.groupLimitOpen) {
const {
chatId
} = this.options
res.groupLimitList.map(e => {
// if ()
if (!chatId) this.setData({
popupType: 1,
popupTitle: '此群无法进行接龙游戏!',
show: true,
disabled: true
})
else {
// res.groupLimitList.map(e => {
// // if ()
// })
}
}
this.setData({
activityDetail: decodeURIComponent(res.description),
......@@ -154,12 +171,13 @@ Page({
list
})
} catch (error) {
console.log(error)
if (error) wx.p.wxApi.showToast(error)
}
},
bindPickerChange: function (e) {
bindPickerChange(e) {
this.setData({
'params.num': e.detail.value
'params.num': this.data.array[e.detail.value]
})
},
inSolitaire() {
......@@ -185,6 +203,7 @@ Page({
console.log(params)
if (!params.name) throw '请输入名称!'
if (!params.num) throw '请选择数字!'
wx.p.wxApi.showLoading()
const res = await wx.p.api.solitaireApi.commitSolitaire({
relayLotteryId,
name: params.name,
......@@ -194,6 +213,8 @@ Page({
relayContent: params.num,
chatId
})
wx.p.wxApi.showToast('提交成功!')
// this.getSolitaireDetail()
console.log(res)
} catch (error) {
if (error) wx.p.wxApi.showToast(error)
......
......@@ -27,7 +27,7 @@
</view>
</block>
<block wx:if="{{!finishObject}}">
<block wx:if="{{!disabled}}">
<view class="input-box">
<block wx:if="{{!flag}}">
<view class="button flex" bindtap="inSolitaire">
......@@ -38,9 +38,9 @@
<view class="input">
<input type="text" placeholder="请输入名称" maxlength="32" placeholder-class="placeholder" value="{{params.name}}" bindinput="input" data-name="params.name" />
</view>
<view class="input {{array[params.num] ?'':'placeholder'}}">
<view class="input {{params.num ?'':'placeholder'}}">
<picker bindchange="bindPickerChange" range="{{array}}">
{{array[params.num] || '请选择数字'}}
{{params.num || '请选择数字'}}
</picker>
<view class="arrow y-center"></view>
</view>
......@@ -53,4 +53,4 @@
</view>
</block>
<solitaire-popup title="{{popupTitle}}" model:show="{{show}}"></solitaire-popup>
\ No newline at end of file
<solitaire-popup title="{{popupTitle}}" type="{{popupType}}" model:show="{{show}}"></solitaire-popup>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!