百度小程序新增签到
parent
6378554644
commit
edade05000
|
|
@ -74,7 +74,7 @@ App({
|
|||
// 请求地址
|
||||
request_url: "{{request_url}}",
|
||||
// request_url: 'http://shopxo.com/',
|
||||
// request_url: 'https://dev.shopxo.net/',
|
||||
request_url: 'https://dev.shopxo.net/',
|
||||
|
||||
// 基础信息
|
||||
application_title: "{{application_title}}",
|
||||
|
|
|
|||
|
|
@ -46,7 +46,14 @@
|
|||
"pages/plugins/invoice/invoice/invoice",
|
||||
"pages/plugins/invoice/invoice-detail/invoice-detail",
|
||||
"pages/plugins/invoice/invoice-saveinfo/invoice-saveinfo",
|
||||
"pages/plugins/invoice/order/order"
|
||||
"pages/plugins/invoice/order/order",
|
||||
"pages/plugins/signin/user/user",
|
||||
"pages/plugins/signin/index-detail/index-detail",
|
||||
"pages/plugins/signin/user-signin/user-signin",
|
||||
"pages/plugins/signin/user-qrcode/user-qrcode",
|
||||
"pages/plugins/signin/user-qrcode-detail/user-qrcode-detail",
|
||||
"pages/plugins/signin/user-qrcode-saveinfo/user-qrcode-saveinfo",
|
||||
"pages/plugins/signin/user-coming-list/user-coming-list"
|
||||
],
|
||||
"window": {
|
||||
"navigationBarTitleText": "{{application_title}}",
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@
|
|||
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">发票抬头<text class="form-group-tips-must">必填</text></view>
|
||||
<input type="text" name="invoice_title" placeholder-class="cr-ccc" class="cr-666" placeholder="发票抬头、最多200个字符" maxlength="200" value="{=data.invoice_title || ''=}" />
|
||||
<input type="text" name="invoice_title" placeholder-class="cr-ccc" class="cr-666" placeholder="发票抬头、最多200个字符" maxlength="200" value="{{data.invoice_title || ''}}" />
|
||||
</view>
|
||||
|
||||
<!-- 企业信息 -->
|
||||
<view s-if="company_container">
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">企业统一社会信用代码或纳税识别号<text class="form-group-tips-must">必填</text></view>
|
||||
<input type="text" name="invoice_code" placeholder-class="cr-ccc" class="cr-666" placeholder="企业统一社会信用代码或纳税识别号、最多160个字符" maxlength="160" value="{=data.invoice_code || ''=}" />
|
||||
<input type="text" name="invoice_code" placeholder-class="cr-ccc" class="cr-666" placeholder="企业统一社会信用代码或纳税识别号、最多160个字符" maxlength="160" value="{{data.invoice_code || ''}}" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -48,19 +48,19 @@
|
|||
<view s-if="company_special_container">
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">企业开户行名称<text class="form-group-tips-must">必填</text></view>
|
||||
<input type="text" name="invoice_bank" placeholder-class="cr-ccc" class="cr-666" placeholder="企业开户行名称、最多200个字符" maxlength="200" value="{=data.invoice_bank || ''=}" />
|
||||
<input type="text" name="invoice_bank" placeholder-class="cr-ccc" class="cr-666" placeholder="企业开户行名称、最多200个字符" maxlength="200" value="{{data.invoice_bank || ''}}" />
|
||||
</view>
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">企业开户帐号<text class="form-group-tips-must">必填</text></view>
|
||||
<input type="text" name="invoice_account" placeholder-class="cr-ccc" class="cr-666" placeholder="企业开户帐号、最多160个字符" maxlength="160" value="{=data.invoice_account || ''=}" />
|
||||
<input type="text" name="invoice_account" placeholder-class="cr-ccc" class="cr-666" placeholder="企业开户帐号、最多160个字符" maxlength="160" value="{{data.invoice_account || ''}}" />
|
||||
</view>
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">企业联系电话<text class="form-group-tips-must">必填</text></view>
|
||||
<input type="text" name="invoice_tel" placeholder-class="cr-ccc" class="cr-666" placeholder="企业联系电话 6~15 个字符" maxlength="15" value="{=data.invoice_tel || ''=}" />
|
||||
<input type="text" name="invoice_tel" placeholder-class="cr-ccc" class="cr-666" placeholder="企业联系电话 6~15 个字符" maxlength="15" value="{{data.invoice_tel || ''}}" />
|
||||
</view>
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">企业注册地址<text class="form-group-tips-must">必填</text></view>
|
||||
<input type="text" name="invoice_address" placeholder-class="cr-ccc" class="cr-666" placeholder="企业注册地址、最多230个字符" maxlength="230" value="{=data.invoice_address || ''=}" />
|
||||
<input type="text" name="invoice_address" placeholder-class="cr-ccc" class="cr-666" placeholder="企业注册地址、最多230个字符" maxlength="230" value="{{data.invoice_address || ''}}" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -68,15 +68,15 @@
|
|||
<view s-if="addressee_container">
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">收件人姓名<text class="form-group-tips-must">必填</text></view>
|
||||
<input type="text" name="name" placeholder-class="cr-ccc" class="cr-666" placeholder="收件人姓名格式 2~30 个字符之间" maxlength="30" value="{=data.name || ''=}" />
|
||||
<input type="text" name="name" placeholder-class="cr-ccc" class="cr-666" placeholder="收件人姓名格式 2~30 个字符之间" maxlength="30" value="{{data.name || ''}}" />
|
||||
</view>
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">收件人电话<text class="form-group-tips-must">必填</text></view>
|
||||
<input type="text" name="tel" placeholder-class="cr-ccc" class="cr-666" placeholder="收件人电话 6~15 个字符" maxlength="15" value="{=data.tel || ''=}" />
|
||||
<input type="text" name="tel" placeholder-class="cr-ccc" class="cr-666" placeholder="收件人电话 6~15 个字符" maxlength="15" value="{{data.tel || ''}}" />
|
||||
</view>
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">收件人地址<text class="form-group-tips-must">必填</text></view>
|
||||
<input type="text" name="address" placeholder-class="cr-ccc" class="cr-666" placeholder="收件人地址、最多230个字符" maxlength="230" value="{=data.address || ''=}" />
|
||||
<input type="text" name="address" placeholder-class="cr-ccc" class="cr-666" placeholder="收件人地址、最多230个字符" maxlength="230" value="{{data.address || ''}}" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -84,13 +84,13 @@
|
|||
<view s-if="email_container">
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">电子邮箱<text class="form-group-tips">选填</text></view>
|
||||
<input type="text" name="email" placeholder-class="cr-ccc" class="cr-666" placeholder="电子邮箱、最多60个字符" maxlength="60" value="{=data.email || ''=}" />
|
||||
<input type="text" name="email" placeholder-class="cr-ccc" class="cr-666" placeholder="电子邮箱、最多60个字符" maxlength="60" value="{{data.email || ''}}" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">备注<text class="form-group-tips">选填</text></view>
|
||||
<input type="text" name="user_note" placeholder-class="cr-ccc" class="cr-666" placeholder="备注最多230个字符" maxlength="60" value="{=data.user_note || ''=}" />
|
||||
<input type="text" name="user_note" placeholder-class="cr-ccc" class="cr-666" placeholder="备注最多230个字符" maxlength="60" value="{{data.user_note || ''}}" />
|
||||
</view>
|
||||
<view class="form-gorup">
|
||||
<button class="bg-main submit-bottom" type="default" formType="submit" hover-class="none" loading="{{form_submit_loading}}" disabled="{{form_submit_loading}}">提交</button>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,132 @@
|
|||
/**
|
||||
* 签到
|
||||
*/
|
||||
.coming-container {
|
||||
background-color: #f6b015;
|
||||
position: relative;
|
||||
padding: 100rpx 0 120rpx 0;
|
||||
}
|
||||
.coming-submit {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
line-height: 200rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #F37B1D;
|
||||
color: #f8fb0b;
|
||||
border: 12rpx solid #f9f420;
|
||||
font-size: 62rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.already-coming {
|
||||
border: 12rpx solid #bebebe;
|
||||
background-color: #ccc;
|
||||
color: #9f9f9f;
|
||||
}
|
||||
.coming-title {
|
||||
color: #fff;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.coming-tips {
|
||||
color: #ffe7b2;
|
||||
}
|
||||
.signin-user-menu-submit {
|
||||
border: 1px solid #fff900;
|
||||
color: #fffb62;
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
padding: 6rpx 20rpx;
|
||||
border-radius: 3rpx;
|
||||
}
|
||||
.detail-submit {
|
||||
margin-left: 20rpx;
|
||||
color: #0e90d2;
|
||||
display: inline;
|
||||
}
|
||||
.submit-container {
|
||||
position: absolute;
|
||||
bottom: 20rpx;
|
||||
right: 20rpx;
|
||||
}
|
||||
.submit-container button:not(:first-child) {
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
.submit-container button.team-submit {
|
||||
color: #5eb95e;
|
||||
background-color: #E4F3E4;
|
||||
border-color: #d2e8d2;
|
||||
}
|
||||
.submit-container button.share-submit {
|
||||
color: #F37B1D;
|
||||
background-color: #ffe5be;
|
||||
border-color: #f8d093;
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到成功提示
|
||||
*/
|
||||
.coming-tips-container {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1050;
|
||||
background: rgb(0 0 0 / 0.6);
|
||||
padding-top: 30%;
|
||||
}
|
||||
.coming-content {
|
||||
max-width: 300px;
|
||||
height: 305px;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
}
|
||||
.coming-content .icon-close-submit {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
}
|
||||
.coming-tips-container image {
|
||||
max-width: 100%;
|
||||
margin-top:60rpx;
|
||||
}
|
||||
.coming-tips-content .coming-tips-text {
|
||||
background: #fff;
|
||||
color: #f00;
|
||||
padding: 10rpx 20rpx;
|
||||
border-radius: 1000rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
.scroll-box {
|
||||
height: calc(100vh - 80rpx);
|
||||
}
|
||||
.data-list {
|
||||
overflow: hidden;
|
||||
}
|
||||
.data-list .items {
|
||||
width: calc(50% - 5rpx);
|
||||
margin-bottom: 10rpx;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
.data-list .items:nth-child(2n) {
|
||||
float: right;
|
||||
}
|
||||
.data-list .items:nth-child(2n+1) {
|
||||
float: left;
|
||||
}
|
||||
.data-list .items image {
|
||||
width: 100%;
|
||||
height: 200px !important;
|
||||
}
|
||||
.data-list .items .base {
|
||||
text-align: left;
|
||||
font-size: 32rpx;
|
||||
padding: 0 15rpx;
|
||||
}
|
||||
.data-list .items .base,
|
||||
.data-list .items .base .price {
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
|
@ -0,0 +1,237 @@
|
|||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
params: null,
|
||||
user: null,
|
||||
data_base: null,
|
||||
data: null,
|
||||
team_signin_data: null,
|
||||
user_signin_data: null,
|
||||
is_already_coming: 0,
|
||||
is_success_tips: 0,
|
||||
coming_integral: 0
|
||||
},
|
||||
|
||||
onReady() {},
|
||||
|
||||
onLoad(params) {
|
||||
//params['id'] = 1;
|
||||
this.setData({
|
||||
params: params,
|
||||
user: app.get_user_cache_info()
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.get_data();
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data() {
|
||||
var self = this;
|
||||
swan.request({
|
||||
url: app.get_request_url("detail", "index", "signin"),
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.data.params.id || 0
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
swan.stopPullDownRefresh();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
data_base: data.base || null,
|
||||
data: data.data || null,
|
||||
team_signin_data: data.team_signin_data || null,
|
||||
user_signin_data: data.user_signin_data || null,
|
||||
is_already_coming: (data.user_signin_data || null) != null && (data.user_signin_data.integral || 0) > 0 ? 1 : 0,
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: true
|
||||
});
|
||||
} else {
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
swan.stopPullDownRefresh();
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '服务器请求出错'
|
||||
});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data();
|
||||
},
|
||||
|
||||
// 初始化
|
||||
init() {
|
||||
var user = app.get_user_info(this, "init"),
|
||||
self = this;
|
||||
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.user_is_need_login(user)) {
|
||||
swan.showModal({
|
||||
title: '温馨提示',
|
||||
content: '绑定手机号码',
|
||||
confirmText: '确认',
|
||||
cancelText: '暂不',
|
||||
success: result => {
|
||||
swan.stopPullDownRefresh();
|
||||
|
||||
if (result.confirm) {
|
||||
swan.navigateTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
// 签到
|
||||
coming_event(e) {
|
||||
if (this.data.is_already_coming != 1 && this.init()) {
|
||||
var self = this;
|
||||
swan.showLoading({
|
||||
title: "处理中..."
|
||||
});
|
||||
swan.request({
|
||||
url: app.get_request_url("coming", "index", "signin"),
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.data.data.id
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
swan.hideLoading();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
this.setData({
|
||||
is_already_coming: 1,
|
||||
is_success_tips: 1,
|
||||
coming_integral: res.data.data
|
||||
});
|
||||
this.get_data();
|
||||
} else {
|
||||
if (app.is_login_check(res.data, self, 'team_request')) {
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
swan.hideLoading();
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 签到成功提示关闭
|
||||
coming_success_close_event(e) {
|
||||
this.setData({
|
||||
is_success_tips: 0
|
||||
});
|
||||
},
|
||||
|
||||
// 组队事件
|
||||
team_event(e) {
|
||||
if (this.init()) {
|
||||
var self = this;
|
||||
swan.showLoading({
|
||||
title: "处理中..."
|
||||
});
|
||||
swan.request({
|
||||
url: app.get_request_url("team", "userqrcode", "signin"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
swan.hideLoading();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
switch (res.data.data.status) {
|
||||
// 组队成功
|
||||
case 0:
|
||||
// 设置签到码id
|
||||
var temp_params = this.data.params;
|
||||
temp_params['id'] = res.data.data.qrcode_id;
|
||||
this.setData({
|
||||
params: temp_params
|
||||
}); // 重新拉取数据
|
||||
|
||||
this.get_data();
|
||||
break;
|
||||
// 需要填写联系人信息
|
||||
|
||||
case 1:
|
||||
swan.navigateTo({
|
||||
url: '/pages/plugins/signin/user-qrcode-saveinfo/user-qrcode-saveinfo?is_team=1'
|
||||
});
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (app.is_login_check(res.data, self, 'team_request')) {
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
swan.hideLoading();
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 图片事件
|
||||
right_images_event(e) {
|
||||
if ((this.data.data.right_images_url || null) != null) {
|
||||
swan.navigateTo({
|
||||
url: this.data.data.right_images_url
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
return {
|
||||
title: this.data.data.seo_title || '签到 - ' + app.data.application_title,
|
||||
desc: this.data.data.seo_desc || '签到获得积分奖励 - ' + app.data.application_describe,
|
||||
path: '/pages/plugins/signin/index-detail/index-detail?id=' + this.data.data.id + '&referrer=' + user_id
|
||||
};
|
||||
},
|
||||
|
||||
// 分享朋友圈
|
||||
onShareTimeline() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
return {
|
||||
title: this.data.data.seo_title || '签到 - ' + app.data.application_title,
|
||||
query: 'id=' + this.data.data.id + '&referrer=' + user_id,
|
||||
imageUrl: this.data.data.right_images || ''
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarBackgroundColor": "#f6b015",
|
||||
"backgroundColorTop": "#f6b015",
|
||||
"backgroundColorBottom": "#f5f5f5",
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarTitleText": "签到"
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<view s-if="(data || null) != null">
|
||||
<!-- 签到 -->
|
||||
<view class="coming-container tc">
|
||||
<navigator s-if="(data_base.is_user_menu || 0) == 1" class="signin-user-menu-submit" url="/pages/plugins/signin/user-signin/user-signin" hover-class="none">我的签到</navigator>
|
||||
<view class="coming-submit {{(is_already_coming == 1) ? 'already-coming' : ''}}" bindtap="coming_event">签到</view>
|
||||
<block s-if="(user || null) == null">
|
||||
<view class="coming-title">登录签到获得积分奖励</view>
|
||||
</block>
|
||||
<block s-else>
|
||||
<!-- 是否已签到 -->
|
||||
<block s-if="(user_signin_data || null) != null && (user_signin_data.integral || 0) > 0">
|
||||
<view class="coming-title">今日已签到,获得{{user_signin_data.integral}}积分,共{{user_signin_data.total}}次</view>
|
||||
<view class="coming-tips">请明日继续签到,更多积分奖励</view>
|
||||
</block>
|
||||
<block s-else>
|
||||
<view class="coming-title am-margin-top-sm">立即签到获得积分奖励</view>
|
||||
</block>
|
||||
|
||||
<!-- 队长 -->
|
||||
<block s-if="(team_signin_data || null) != null && user.id == data.user_id">
|
||||
<view class="coming-title">
|
||||
<text>今日{{team_signin_data.day}}人签到,共{{team_signin_data.total}}人</text>
|
||||
<navigator s-if="(data_base.is_team_show_coming_user || 0) == 1" url="/pages/plugins/signin/user-coming-list/user-coming-list?id={{data.id}}" hover-class="none" class="detail-submit">详情 >></navigator>
|
||||
</view>
|
||||
<view class="coming-tips">分享获得更多奖励</view>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<!-- 按钮组 -->
|
||||
<view class="submit-container">
|
||||
<button s-if="(data_base.is_team) == 1 && (user || null) != null && data.user_id != user.id" type="default" size="mini" class="team-submit" bindtap="team_event">组队</button>
|
||||
<button s-if="(data_base.is_share) == 1" type="default" size="mini" open-type="share" class="share-submit">分享</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 广告图片 -->
|
||||
<image s-if="(data.right_images || null) != null" src="{{data.right_images}}" class="wh-auto dis-block spacing-mt" mode="widthFix" bindtap="right_images_event" />
|
||||
|
||||
<!-- 公告信息 -->
|
||||
<view s-if="(data_base.signin_desc || null) != null && data_base.signin_desc.length > 0" class="tips spacing-mt">
|
||||
<view s-for="item, index in data_base.signin_desc" s-key="key" class="item">
|
||||
{{item}}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 推荐商品 -->
|
||||
<view s-if="(data.goods_list || null) != null && data.goods_list.length > 0" class="spacing-mt">
|
||||
<view class="spacing-nav-title">
|
||||
<text class="line"></text>
|
||||
<text class="text-wrapper">推荐商品</text>
|
||||
</view>
|
||||
<view class="data-list spacing-10">
|
||||
<view class="items bg-white" s-for="item, index in data.goods_list" s-key="key">
|
||||
<navigator url="/pages/goods-detail/goods-detail?goods_id={{item.id}}" hover-class="none">
|
||||
<image src="{{item.images}}" mode="aspectFit" />
|
||||
<view class="base">
|
||||
<view class="multi-text">{{item.title}}</view>
|
||||
<view class="price">
|
||||
<text class="sales-price">{{currency_symbol}}{{item.min_price}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 签到成功提示信息 -->
|
||||
<view s-if="is_success_tips == 1" class="coming-tips-container am-text-center">
|
||||
<view class="coming-content tc">
|
||||
<view class="icon-close-submit" bindtap="coming_success_close_event">
|
||||
<icon type="clear" size="20" />
|
||||
</view>
|
||||
<image src="/images/plugins/signin/coming-success-icon.png" mode="widthFix" />
|
||||
<view class="coming-tips-content">
|
||||
<text class="coming-tips-text">获得 <text>{{coming_integral}}</text> 积分</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<import src="/pages/common/bottom_line.swan" />
|
||||
<template is="bottom_line" data="{{{status: data_bottom_line_status}}}"></template>
|
||||
</view>
|
||||
<view s-else>
|
||||
<import src="/pages/common/nodata.swan" />
|
||||
<template is="nodata" data="{{{status: data_list_loding_status, msg: data_list_loding_msg}}}"></template>
|
||||
</view>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
.scroll-box {
|
||||
height: 100vh;
|
||||
}
|
||||
.data-list .item .base {
|
||||
padding: 15rpx 10rpx;
|
||||
}
|
||||
.data-list .item .base .avatar {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.data-list .item .base .nickname {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.data-list .item .content {
|
||||
padding: 20rpx 10rpx;
|
||||
}
|
||||
.data-list .item .content .single-text {
|
||||
line-height: 50rpx;
|
||||
}
|
||||
.data-list .item .content .single-text .title {
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
.data-list .item .content .single-text .value {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
params: null,
|
||||
data_list: [],
|
||||
data_page_total: 0,
|
||||
data_page: 1
|
||||
},
|
||||
|
||||
onReady() {},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({
|
||||
params: params
|
||||
});
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {},
|
||||
|
||||
init() {
|
||||
var user = app.get_user_info(this, 'init');
|
||||
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.user_is_need_login(user)) {
|
||||
swan.redirectTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data.data_bottom_line_status == true) {
|
||||
return false;
|
||||
}
|
||||
} // 加载loding
|
||||
|
||||
|
||||
swan.showLoading({
|
||||
title: "加载中..."
|
||||
});
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
}); // 获取数据
|
||||
|
||||
swan.request({
|
||||
url: app.get_request_url("usercominglist", "userqrcode", "signin"),
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.data.params.id || 0,
|
||||
page: this.data.data_page
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
swan.hideLoading();
|
||||
swan.stopPullDownRefresh();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = res.data.data.data;
|
||||
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1
|
||||
}); // 是否还有数据
|
||||
|
||||
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total) {
|
||||
this.setData({
|
||||
data_bottom_line_status: true
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list: [],
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
|
||||
if (app.is_login_check(res.data, this, 'get_data_list')) {
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
swan.hideLoading();
|
||||
swan.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 头像查看
|
||||
avatar_event(e) {
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
|
||||
if (value != null) {
|
||||
swan.previewImage({
|
||||
current: value,
|
||||
urls: [value]
|
||||
});
|
||||
} else {
|
||||
app.showToast('头像地址有误');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarBackgroundColor": "#f6b015",
|
||||
"backgroundColorTop": "#f6b015",
|
||||
"backgroundColorBottom": "#f5f5f5",
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarTitleText": "用户签到"
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<scroll-view scroll-y="{{true}}" class="scroll-box" bindscrolltolower="scroll_lower" lower-threshold="30">
|
||||
<view class="data-list">
|
||||
<view class="item bg-white spacing-mb" s-if="data_list.length > 0" s-for="item, index in data_list" s-key="key">
|
||||
<view class="base oh br-b">
|
||||
<image src="{{item.user.avatar}}" class="avatar dis-block fl" mode="widthFix" bindtap="avatar_event" data-value="{{item.user.avatar}}" />
|
||||
<text class="fr nickname cr-888">{{item.user.user_name_view || ''}}</text>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="single-text">
|
||||
<text class="title cr-666">奖励积分</text>
|
||||
<text class="value">{{item.integral}}</text>
|
||||
</view>
|
||||
<view class="single-text">
|
||||
<text class="title cr-666">签到时间</text>
|
||||
<text class="value">{{item.add_time}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view s-if="data_list.length == 0">
|
||||
<import src="/pages/common/nodata.swan" />
|
||||
<template is="nodata" data="{{{status: data_list_loding_status}}}">
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<import src="/pages/common/bottom_line.swan" />
|
||||
<template is="bottom_line" data="{{{status: data_bottom_line_status}}}"></template>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
.panel-item .panel-title {
|
||||
background: #fff;
|
||||
font-weight: bold;
|
||||
padding: 15rpx;
|
||||
border-bottom: 2px solid #eee;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
.panel-item .panel-content .item {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.panel-item .panel-content .item:last-child {
|
||||
border: 0;
|
||||
}
|
||||
.panel-item .panel-content .item .title {
|
||||
width: 25%;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
.panel-item .panel-content .item .content {
|
||||
width: calc(75% - 50rpx);
|
||||
padding-left: 20rpx;
|
||||
min-height: 46rpx;
|
||||
word-wrap: break-word;
|
||||
word-break: normal;
|
||||
}
|
||||
.panel-item .panel-content .item view {
|
||||
line-height: 46rpx;
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
params: null,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_bottom_line_status: false,
|
||||
detail: null,
|
||||
detail_list: [],
|
||||
express_data: []
|
||||
},
|
||||
|
||||
onReady() {},
|
||||
|
||||
onLoad(params) {
|
||||
//params['id'] = 1;
|
||||
this.setData({
|
||||
params: params
|
||||
});
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {},
|
||||
|
||||
init() {
|
||||
var self = this;
|
||||
swan.showLoading({
|
||||
title: "加载中..."
|
||||
});
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
swan.request({
|
||||
url: app.get_request_url("detail", "userqrcode", "signin"),
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.data.params.id
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
swan.hideLoading();
|
||||
swan.stopPullDownRefresh();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
detail: data.data,
|
||||
detail_list: [
|
||||
{ name: "是否启用", value: data.data.is_enable_name || '' },
|
||||
{ name: "邀请人奖励积分", value: data.data.reward_master || '' },
|
||||
{ name: "受邀人奖励积分", value: data.data.reward_invitee || '' },
|
||||
{ name: "联系人姓名", value: data.data.name || '' },
|
||||
{ name: "联系人电话", value: data.data.tel || '' },
|
||||
{ name: "联系人地址", value: data.data.address || '' },
|
||||
{ name: "创建时间", value: data.data.add_time || '' },
|
||||
{ name: "更新时间", value: data.data.upd_time || '' },
|
||||
],
|
||||
express_data: [
|
||||
{ name: "快递名称", value: data.data.express_name || '' },
|
||||
{ name: "快递单号", value: data.data.express_number || '' },
|
||||
],
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: true,
|
||||
data_list_loding_msg: '',
|
||||
});
|
||||
} else {
|
||||
self.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: res.data.msg
|
||||
});
|
||||
|
||||
if (app.is_login_check(res.data, self, 'init')) {
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
swan.hideLoading();
|
||||
swan.stopPullDownRefresh();
|
||||
self.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: '服务器请求出错'
|
||||
});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarBackgroundColor": "#f6b015",
|
||||
"backgroundColorTop": "#f6b015",
|
||||
"backgroundColorBottom": "#f5f5f5",
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarTitleText": "签到码详情"
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<view s-if="detail != null">
|
||||
<!-- 基础信息 -->
|
||||
<view s-if="detail_list.length > 0" class="panel-item">
|
||||
<view class="panel-content bg-white">
|
||||
<view class="panel-title">基础信息</view>
|
||||
<view s-for="item, index in detail_list" s-key="item" class="item br-b oh">
|
||||
<view class="title fl">{{item.name}}</view>
|
||||
<view class="content fl br-l">{{item.value}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 连续签到翻倍奖励配置 -->
|
||||
<view s-if="(detail.continuous_rules || null) != null && detail.continuous_rules.length > 0" class="panel-item spacing-mt">
|
||||
<view class="panel-content bg-white">
|
||||
<view class="panel-title">连续签到翻倍奖励配置</view>
|
||||
<view s-for="item, index in detail.continuous_rules" s-key="item" class="item br-b oh">
|
||||
<view class="content fl br-l">连续{{item.number}}天、翻{{item.value}}倍</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 指定时段额外奖励 -->
|
||||
<view s-if="(detail.specified_time_reward || null) != null && (detail.specified_time_reward.time_start || null) != null && (detail.specified_time_reward.time_end || null) != null && (detail.specified_time_reward.value || null) != null" class="panel-item spacing-mt">
|
||||
<view class="panel-content bg-white">
|
||||
<view class="panel-title">指定时段额外奖励</view>
|
||||
<view class="item br-b oh">
|
||||
<view class="content fl br-l">时段 {{detail.specified_time_reward.time_start}} ~ {{detail.specified_time_reward.time_end}}、额外奖励 {{detail.specified_time_reward.value}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<import src="/pages/common/bottom_line.swan" />
|
||||
<template is="bottom_line" data="{{{status: data_bottom_line_status}}}"></template>
|
||||
</view>
|
||||
|
||||
<view s-if="detail == null">
|
||||
<import src="/pages/common/nodata.swan" />
|
||||
<template is="nodata" data="{{{status: data_list_loding_status, msg: data_list_loding_msg}}}"></template>
|
||||
|
||||
<view s-if="data_list_loding_status != 1" class="nav-back tc wh-auto">
|
||||
<navigator open-type="navigateBack" hover-class="none">
|
||||
<button type="default" size="mini" class="cr-888 br" hover-class="none">返回</button>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
.content-top {
|
||||
padding: 30rpx 10rpx;
|
||||
}
|
||||
.content-top text {
|
||||
font-size: 38rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.submit-bottom {
|
||||
background-color: #f6b015 !important;
|
||||
}
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
params: null,
|
||||
form_submit_loading: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_base: null,
|
||||
data: null
|
||||
},
|
||||
|
||||
onReady() {},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({
|
||||
params: params
|
||||
});
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {},
|
||||
|
||||
init() {
|
||||
var self = this;
|
||||
swan.showLoading({
|
||||
title: "加载中..."
|
||||
});
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
swan.request({
|
||||
url: app.get_request_url("saveinfo", "userqrcode", "signin"),
|
||||
method: "POST",
|
||||
data: this.data.params,
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
swan.hideLoading();
|
||||
swan.stopPullDownRefresh();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
data_base: data.base || null,
|
||||
data: data.data || null,
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
} else {
|
||||
self.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg
|
||||
});
|
||||
|
||||
if (app.is_login_check(res.data, self, 'init')) {
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
swan.hideLoading();
|
||||
swan.stopPullDownRefresh();
|
||||
self.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '服务器请求出错'
|
||||
});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 表单提交
|
||||
formSubmit(e) {
|
||||
var data = e.detail.value;
|
||||
|
||||
if ((this.data.data || null) != null) {
|
||||
data['id'] = this.data.data.id || 0;
|
||||
} // 数据验证
|
||||
|
||||
|
||||
var validation = [{
|
||||
fields: 'name',
|
||||
msg: '请填写联系人姓名格式 2~30 个字符之间'
|
||||
}, {
|
||||
fields: 'tel',
|
||||
msg: '请填写联系人电话 6~15 个字符'
|
||||
}, {
|
||||
fields: 'address',
|
||||
msg: '请填写联系人地址、最多230个字符'
|
||||
}];
|
||||
|
||||
if (app.fields_check(data, validation)) {
|
||||
swan.showLoading({
|
||||
title: '提交中...'
|
||||
});
|
||||
this.setData({
|
||||
form_submit_loading: true
|
||||
}); // 网络请求
|
||||
|
||||
var self = this;
|
||||
swan.request({
|
||||
url: app.get_request_url("save", "userqrcode", "signin"),
|
||||
method: 'POST',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
success: res => {
|
||||
swan.hideLoading();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
app.showToast(res.data.msg, "success");
|
||||
setTimeout(function () {
|
||||
// 是否签到也组队
|
||||
if ((self.data.params || null) != null && (self.data.params.is_team || 0) == 1) {
|
||||
swan.redirectTo({
|
||||
url: "/pages/plugins/signin/index-detail/index-detail?id=" + res.data.data
|
||||
});
|
||||
} else {
|
||||
swan.navigateBack();
|
||||
}
|
||||
}, 2000);
|
||||
} else {
|
||||
this.setData({
|
||||
form_submit_loading: false
|
||||
});
|
||||
|
||||
if (app.is_login_check(res.data)) {
|
||||
app.showToast(res.data.msg);
|
||||
} else {
|
||||
app.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
swan.hideLoading();
|
||||
this.setData({
|
||||
form_submit_loading: false
|
||||
});
|
||||
app.showToast('服务器请求出错');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarBackgroundColor": "#f6b015",
|
||||
"backgroundColorTop": "#f6b015",
|
||||
"backgroundColorBottom": "#f5f5f5",
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarTitleText": "签到码新增/编辑"
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<form s-if="data_list_loding_status != 1" bindsubmit="formSubmit">
|
||||
<view class="content-top bg-white spacing-mb">
|
||||
<view>邀请人奖励 <text class="cr-main">{{data.reward_master || data_base.reward_master}}</text> 积分</view>
|
||||
<view>受邀人奖励 <text class="cr-main">{{data.reward_invitee || data_base.reward_invitee}}</text> 积分</view>
|
||||
</view>
|
||||
<view class="form-container spacing-mb oh">
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">联系人姓名<text class="form-group-tips-must">必填</text></view>
|
||||
<input type="text" name="name" placeholder-class="cr-ccc" class="cr-666" placeholder="联系人姓名格式 2~30 个字符之间" maxlength="30" value="{{data.name || ''}}" />
|
||||
</view>
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">联系人电话<text class="form-group-tips-must">必填</text></view>
|
||||
<input type="text" name="tel" placeholder-class="cr-ccc" class="cr-666" placeholder="联系人电话 6~15 个字符" maxlength="15" value="{{data.tel || ''}}" />
|
||||
</view>
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">联系人地址<text class="form-group-tips-must">必填</text></view>
|
||||
<input type="text" name="address" placeholder-class="cr-ccc" class="cr-666" placeholder="联系人地址、最多230个字符" maxlength="230" value="{{data.address || ''}}" />
|
||||
</view>
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">备注<text class="form-group-tips">选填</text></view>
|
||||
<input type="text" name="note" placeholder-class="cr-ccc" class="cr-666" placeholder="备注最多230个字符" maxlength="60" value="{{data.note || ''}}" />
|
||||
</view>
|
||||
<view class="form-gorup">
|
||||
<button class="bg-main submit-bottom" type="default" formType="submit" hover-class="none" loading="{{form_submit_loading}}" disabled="{{form_submit_loading}}">提交</button>
|
||||
</view>
|
||||
</view>
|
||||
</form>
|
||||
<view s-if="data_list_loding_status != 0">
|
||||
<import src="/pages/common/nodata.swan" />
|
||||
<template is="nodata" data="{{{status: data_list_loding_status, msg: data_list_loding_msg}}}"></template>
|
||||
</view>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 列表
|
||||
*/
|
||||
.data-list .item .base,
|
||||
.data-list .item .content {
|
||||
padding: 20rpx 10rpx;
|
||||
}
|
||||
.data-list .item .content .single-text {
|
||||
line-height: 50rpx;
|
||||
}
|
||||
.data-list .item .content .single-text .title {
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
.data-list .item .content .single-text .value {
|
||||
font-weight: 500;
|
||||
}
|
||||
.data-list .item .content .single-text .unit {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.data-list .item .operation {
|
||||
padding: 20rpx 10rpx;
|
||||
}
|
||||
.data-list .item .operation button:not(:first-child) {
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
|
||||
/*
|
||||
* 组队签到
|
||||
*/
|
||||
.user-team-container {
|
||||
padding-top: 35%;
|
||||
}
|
||||
.user-team-container button {
|
||||
margin: 0 auto;
|
||||
margin-bottom: 50rpx;
|
||||
width: 50%;
|
||||
background-color: #f6b015;
|
||||
color: #fff;
|
||||
}
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
params: null,
|
||||
data_base: null,
|
||||
data_list: [],
|
||||
data_page_total: 0,
|
||||
data_page: 1
|
||||
},
|
||||
|
||||
onReady() {},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({
|
||||
params: params
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
init() {
|
||||
var user = app.get_user_info(this, 'init');
|
||||
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.user_is_need_login(user)) {
|
||||
swan.redirectTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data.data_bottom_line_status == true) {
|
||||
return false;
|
||||
}
|
||||
} // 加载loding
|
||||
|
||||
|
||||
swan.showLoading({
|
||||
title: "加载中..."
|
||||
});
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
}); // 请求数据
|
||||
|
||||
var data = {
|
||||
page: this.data.data_page
|
||||
}; // 获取数据
|
||||
|
||||
swan.request({
|
||||
url: app.get_request_url("index", "userqrcode", "signin"),
|
||||
method: "POST",
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
swan.hideLoading();
|
||||
swan.stopPullDownRefresh();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = res.data.data.data;
|
||||
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
data_base: res.data.data.base || null,
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1
|
||||
}); // 是否还有数据
|
||||
|
||||
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total) {
|
||||
this.setData({
|
||||
data_bottom_line_status: true
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_base: res.data.data.base || null,
|
||||
data_list_loding_status: 0,
|
||||
data_list: [],
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
|
||||
if (app.is_login_check(res.data, this, 'get_data_list')) {
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
swan.hideLoading();
|
||||
swan.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 查看详情
|
||||
show_event(e) {
|
||||
var value = e.currentTarget.dataset.value;
|
||||
swan.navigateTo({
|
||||
url: '/pages/plugins/signin/index-detail/index-detail?id=' + value
|
||||
});
|
||||
},
|
||||
|
||||
// 签到用户
|
||||
coming_event(e) {
|
||||
var value = e.currentTarget.dataset.value;
|
||||
swan.navigateTo({
|
||||
url: '/pages/plugins/signin/user-coming-list/user-coming-list?id=' + value
|
||||
});
|
||||
},
|
||||
|
||||
// 编辑
|
||||
edit_event(e) {
|
||||
var value = e.currentTarget.dataset.value;
|
||||
swan.navigateTo({
|
||||
url: '/pages/plugins/signin/user-qrcode-saveinfo/user-qrcode-saveinfo?id=' + value
|
||||
});
|
||||
},
|
||||
|
||||
// 组队签到
|
||||
team_event(e) {
|
||||
swan.navigateTo({
|
||||
url: '/pages/plugins/signin/user-qrcode-saveinfo/user-qrcode-saveinfo'
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarBackgroundColor": "#f6b015",
|
||||
"backgroundColorTop": "#f6b015",
|
||||
"backgroundColorBottom": "#f5f5f5",
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarTitleText": "签到码管理"
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<scroll-view scroll-y="{{true}}" class="scroll-box" bindscrolltolower="scroll_lower" lower-threshold="30">
|
||||
<view class="data-list">
|
||||
<block s-if="data_list.length > 0">
|
||||
<view class="item bg-white spacing-mb" s-for="item, index in data_list" s-key="key">
|
||||
<view class="base oh br-b">
|
||||
<text class="cr-666">{{item.add_time}}</text>
|
||||
</view>
|
||||
<navigator url="/pages/plugins/signin/user-qrcode-detail/user-qrcode-detail?id={{item.id}}" hover-class="none">
|
||||
<view class="content">
|
||||
<view class="single-text">
|
||||
<text class="title cr-666">是否启用</text>
|
||||
<text class="value">{{item.is_enable_name}}</text>
|
||||
</view>
|
||||
<view class="single-text">
|
||||
<text class="title cr-666">邀请人奖励积分</text>
|
||||
<text class="value">{{item.reward_master}}</text>
|
||||
</view>
|
||||
<view class="single-text">
|
||||
<text class="title cr-666">受邀人奖励积分</text>
|
||||
<text class="value">{{item.reward_invitee}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
<view class="operation tr br-t-dashed">
|
||||
<button class="cr-666 br" type="default" size="mini" hover-class="none" data-value="{{item.id}}" bindtap="show_event">查看</button>
|
||||
<button s-if="(data_base.is_team_show_coming_user || 0) == 1" class="cr-666 br" type="default" size="mini" hover-class="none" data-value="{{item.id}}" bindtap="coming_event">签到</button>
|
||||
<button class="cr-666 br" type="default" size="mini" hover-class="none" data-value="{{item.id}}" bindtap="edit_event">编辑</button>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<block s-else>
|
||||
<view s-if="(data_base || null) != null && (data_base.is_team || 0) == 1" class="user-team-container tc">
|
||||
<button type="default" hover-class="none" bindtap="team_event">组队签到</button>
|
||||
<view>组队分享让更多人参与签到、获得更多积分奖励</view>
|
||||
</view>
|
||||
<view s-else>
|
||||
<import src="/pages/common/nodata.swan" />
|
||||
<template is="nodata" data="{{{status: data_list_loding_status}}}"></template>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<import src="/pages/common/bottom_line.swan" />
|
||||
<template is="bottom_line" data="{{{status: data_bottom_line_status}}}"></template>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
.scroll-box {
|
||||
height: 100vh;
|
||||
}
|
||||
.data-list .item .content {
|
||||
padding: 20rpx 10rpx;
|
||||
}
|
||||
.data-list .item .content .single-text {
|
||||
line-height: 50rpx;
|
||||
}
|
||||
.data-list .item .content .single-text .title {
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
.data-list .item .content .single-text .value {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_list: [],
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
params: null
|
||||
},
|
||||
|
||||
onReady() {},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({
|
||||
params: params
|
||||
});
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {},
|
||||
|
||||
init() {
|
||||
var user = app.get_user_info(this, 'init');
|
||||
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.user_is_need_login(user)) {
|
||||
swan.redirectTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data.data_bottom_line_status == true) {
|
||||
return false;
|
||||
}
|
||||
} // 加载loding
|
||||
|
||||
|
||||
swan.showLoading({
|
||||
title: "加载中..."
|
||||
});
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
}); // 获取数据
|
||||
|
||||
swan.request({
|
||||
url: app.get_request_url("index", "usersignin", "signin"),
|
||||
method: "POST",
|
||||
data: {
|
||||
page: this.data.data_page
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
swan.hideLoading();
|
||||
swan.stopPullDownRefresh();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = res.data.data.data;
|
||||
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1
|
||||
}); // 是否还有数据
|
||||
|
||||
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total) {
|
||||
this.setData({
|
||||
data_bottom_line_status: true
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list: [],
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
|
||||
if (app.is_login_check(res.data, this, 'get_data_list')) {
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
swan.hideLoading();
|
||||
swan.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarBackgroundColor": "#f6b015",
|
||||
"backgroundColorTop": "#f6b015",
|
||||
"backgroundColorBottom": "#f5f5f5",
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarTitleText": "我的签到"
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<scroll-view scroll-y="{{true}}" class="scroll-box" bindscrolltolower="scroll_lower" lower-threshold="30">
|
||||
<view class="data-list">
|
||||
<view class="item bg-white spacing-mb" s-if="data_list.length > 0" s-for="item, index in data_list" s-key="key">
|
||||
<view class="content">
|
||||
<view class="single-text">
|
||||
<text class="title cr-666">奖励积分</text>
|
||||
<text class="value">{{item.integral}}</text>
|
||||
</view>
|
||||
<view class="single-text">
|
||||
<text class="title cr-666">签到时间</text>
|
||||
<text class="value">{{item.add_time}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view s-if="data_list.length == 0">
|
||||
<import src="/pages/common/nodata.swan" />
|
||||
<template is="nodata" data="{{{status: data_list_loding_status}}}">
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<import src="/pages/common/bottom_line.swan" />
|
||||
<template is="bottom_line" data="{{{status: data_bottom_line_status}}}"></template>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* 导航
|
||||
*/
|
||||
.nav {
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
.nav .item {
|
||||
padding: 30rpx 0;
|
||||
width: calc(50% - 1px);
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.nav .item:nth-child(odd) {
|
||||
border-right: 1px solid #eee;
|
||||
}
|
||||
.nav .item image {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.nav .item .title {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
/*
|
||||
* 提示信息
|
||||
*/
|
||||
.tips-container {
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_base: null,
|
||||
nav_list: []
|
||||
},
|
||||
|
||||
onReady() {},
|
||||
|
||||
onLoad(params) {},
|
||||
|
||||
onShow() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
init(e) {
|
||||
var user = app.get_user_info(this, "init"),
|
||||
self = this;
|
||||
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.user_is_need_login(user)) {
|
||||
swan.showModal({
|
||||
title: '温馨提示',
|
||||
content: '绑定手机号码',
|
||||
confirmText: '确认',
|
||||
cancelText: '暂不',
|
||||
success: result => {
|
||||
swan.stopPullDownRefresh();
|
||||
|
||||
if (result.confirm) {
|
||||
swan.navigateTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
self.get_data();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data() {
|
||||
var self = this;
|
||||
swan.request({
|
||||
url: app.get_request_url("center", "user", "signin"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
swan.stopPullDownRefresh();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
// 是否开启组队
|
||||
var temp_nav_list = [{
|
||||
icon: "/images/plugins/signin/user-signin-icon.png",
|
||||
title: "我的签到",
|
||||
url: "/pages/plugins/signin/user-signin/user-signin"
|
||||
}];
|
||||
|
||||
if ((data.base || null) != null && (data.base.is_team || 0) == 1) {
|
||||
temp_nav_list.push({
|
||||
icon: "/images/plugins/signin/user-qrcode-icon.png",
|
||||
title: "签到码管理",
|
||||
url: "/pages/plugins/signin/user-qrcode/user-qrcode"
|
||||
});
|
||||
}
|
||||
|
||||
self.setData({
|
||||
data_base: data.base || null,
|
||||
nav_list: temp_nav_list,
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
} else {
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg
|
||||
});
|
||||
|
||||
if (app.is_login_check(res.data, self, 'get_data')) {
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
swan.stopPullDownRefresh();
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '服务器请求出错'
|
||||
});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data();
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarBackgroundColor": "#f6b015",
|
||||
"backgroundColorTop": "#f6b015",
|
||||
"backgroundColorBottom": "#f5f5f5",
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarTitleText": "签到"
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<!-- 导航 -->
|
||||
<view s-if="nav_list.length > 0" class="nav oh bg-white">
|
||||
<block s-for="item, index in nav_list" s-key="key">
|
||||
<navigator url="{{item.url}}" hover-class="none">
|
||||
<view class="item fl tc">
|
||||
<image src="{{item.icon}}" mode="scaleToFill" class="dis-block" />
|
||||
<view class="title">{{item.title}}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 通知 -->
|
||||
<view s-if="(data_base || null) != null && (data_base.signin_desc || null) != null && data_base.signin_desc.length > 0" class="tips-container spacing-mt">
|
||||
<view class="tips">
|
||||
<view s-for="item, index in data_base.signin_desc" s-key="key" class="item">
|
||||
{{item}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
Loading…
Reference in New Issue