This commit is contained in:
周中平 2020-04-25 23:04:41 +08:00
parent 5289d0af43
commit 25542e0535
19 changed files with 555 additions and 243 deletions

View File

@ -10,6 +10,17 @@
## 更新日志
### v1.1.41
```
新增:微信小程序订阅消息
修复多开小程序直播间同步ID问题
修复库存1下单后提示商品库存不足
修复拼团商品预览sku图片报错
优化:超管后台删除商家用户
注:本次更新须重新发布小程序
```
### v1.1.40
```
新增:微信小程序直播功能

View File

@ -9,31 +9,48 @@ Page({
data: {
is_read: false,
disabled: false,
submsgSetting: {}, // 订阅消息配置
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad(options) {
let _this = this;
// 获取订阅消息配置
_this.getSubmsgSetting();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow() {
let _this = this;
// 获取分销商申请状态
this.getApplyState();
_this.getApplyState();
},
/**
* 获取订阅消息配置
*/
getSubmsgSetting() {
let _this = this;
App._get('wxapp.submsg/setting', {}, (result) => {
_this.setData({
submsgSetting: result.data.setting
});
});
},
/**
* 获取分销商申请状态
*/
getApplyState: function() {
getApplyState() {
let _this = this;
App._get('user.dealer/apply', {
referee_id: _this.getRefereeid()
}, function(result) {
}, (result) => {
let data = result.data;
// 当前是否已经为分销商
if (data.is_dealer) {
@ -53,7 +70,7 @@ Page({
/**
* 显示申请协议
*/
toggleApplyLicense: function() {
toggleApplyLicense() {
Dialog({
title: '申请协议',
message: this.data.license,
@ -72,8 +89,9 @@ Page({
/**
* 已阅读
*/
toggleSetRead: function() {
this.setData({
toggleSetRead() {
let _this = this;
_this.setData({
is_read: !this.data.is_read
});
},
@ -81,13 +99,10 @@ Page({
/**
* 提交申请
*/
formSubmit: function(e) {
onFormSubmit(e) {
let _this = this,
values = e.detail.value;
// 记录formId
App.saveFormId(e.detail.formId);
// 验证姓名
if (!values.name || values.name.length < 1) {
App.showError('请填写姓名');
@ -112,10 +127,10 @@ Page({
});
// 数据提交
App._post_form('user.dealer.apply/submit', values, function() {
App._post_form('user.dealer.apply/submit', values, () => {
// 获取分销商申请状态
_this.getApplyState();
}, null, function() {
}, null, () => {
// 解除按钮禁用
_this.setData({
disabled: false
@ -126,19 +141,33 @@ Page({
/**
* 去商城逛逛
*/
navigationToIndex: function(e) {
// 记录formId
App.saveFormId(e.detail.formId);
navigationToIndex(e) {
// 跳转到首页
wx.switchTab({
url: '/pages/index/index',
})
},
/**
* 订阅消息通知
*/
onSubMsg() {
let _this = this;
let tmplItem = _this.data.submsgSetting.dealer.apply.template_id;
if (tmplItem.length > 0) {
wx.requestSubscribeMessage({
tmplIds: [tmplItem],
success(res) {},
fail(res) {},
complete(res) {},
});
}
},
/**
* 获取推荐人id
*/
getRefereeid: function() {
getRefereeid() {
return wx.getStorageSync('referee_id');
},

View File

@ -11,7 +11,7 @@
<view class="widget-form b-f m-top20 dis-flex flex-dir-column">
<view class="form-title f-30">{{ words.apply.words.title.value }}</view>
<view class="form-box dis-flex flex-dir-column">
<form bindsubmit="formSubmit" report-submit="true">
<form bindsubmit="onFormSubmit" report-submit="true">
<view class="form-field dis-flex flex-y-center">
<view class="field-label">邀请人</view>
<view class="field-input">
@ -61,6 +61,10 @@
<button formType="submit">{{ words.apply.words.goto_mall.value }}</button>
</form>
</view>
<!-- 订阅消息通知 -->
<view class="boot__submsg" catchtap="onSubMsg">
<text class="iconfont icon-iconxx"></text>
<text class="f-29">点击订阅消息通知</text>
</view>
</view>
</view>

View File

@ -94,3 +94,13 @@ page {
.dealer-boot .boot__submit {
margin-top: 60rpx;
}
.boot__submsg {
margin-top: 30rpx;
font-size: 28rpx;
color: #786cff;
line-height: 1.5;
}
.boot__submsg .iconfont {
margin-right: 6rpx;
}

View File

@ -10,29 +10,46 @@ Page({
words: {},
payment: 20,
submsgSetting: {}, // 订阅消息配置
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad(options) {
let _this = this;
// 获取订阅消息配置
_this.getSubmsgSetting();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow() {
let _this = this;
// 获取分销商提现信息
this.getDealerWithdraw();
_this.getDealerWithdraw();
},
/**
* 获取订阅消息配置
*/
getSubmsgSetting() {
let _this = this;
App._get('wxapp.submsg/setting', {}, (result) => {
_this.setData({
submsgSetting: result.data.setting
});
});
},
/**
* 获取分销商提现信息
*/
getDealerWithdraw: function() {
getDealerWithdraw() {
let _this = this;
App._get('user.dealer/withdraw', {}, function(result) {
App._get('user.dealer/withdraw', {}, (result) => {
let data = result.data;
data.isData = true;
// 设置当前页面标题
@ -48,14 +65,11 @@ Page({
/**
* 提交申请
*/
formSubmit: function(e) {
onFormSubmit(e) {
let _this = this,
values = e.detail.value,
words = _this.data.words.withdraw_apply.words;
// 记录formId
App.saveFormId(e.detail.formId);
// 验证可提现佣金
if (_this.data.dealer.money <= 0) {
App.showError('当前没有' + words.capital.value);
@ -72,30 +86,71 @@ Page({
});
// 提现方式
values['pay_type'] = _this.data.payment;
// 数据提交
const onCallback = () => {
App._post_form('user.dealer.withdraw/submit', {
data: JSON.stringify(values)
}, function(result) {
}, (result) => {
// 提交成功
// console.log(result);
App.showError(result.msg, function() {
App.showError(result.msg, () => {
wx.navigateTo({
url: '../list/list',
})
});
}, null, function() {
}, null, () => {
// 解除按钮禁用
_this.setData({
disabled: false
});
});
};
// 确认是否提交
wx.showModal({
// title: '友情提示',
content: '确定提交提现申请吗?请确认填写无误',
showCancel: true,
success(res) {
if (res.confirm) {
// 请求用户订阅消息
_this._onRequestSubscribeMessage(onCallback);
} else if (res.cancel) {
// 解除按钮禁用
_this.setData({
disabled: false
});
}
}
});
},
/**
* 订阅消息 => [提现通知]
*/
_onRequestSubscribeMessage(callback) {
let _this = this,
tmplIds = [],
dealerSubmsg = _this.data.submsgSetting.dealer;
dealerSubmsg.withdraw_01.template_id != '' && tmplIds.push(dealerSubmsg.withdraw_01.template_id);
dealerSubmsg.withdraw_02.template_id != '' && tmplIds.push(dealerSubmsg.withdraw_02.template_id);
if (tmplIds.length > 0) {
wx.requestSubscribeMessage({
tmplIds,
success(res) {},
fail(res) {},
complete(res) {
callback && callback();
},
});
}
},
/**
* 切换提现方式
*/
toggleChecked: function(e) {
this.setData({
toggleChecked(e) {
let _this = this;
_this.setData({
payment: e.currentTarget.dataset.payment
});
},

View File

@ -6,7 +6,7 @@
</view>
<view class="widget-body b-f dis-flex flex-dir-column flex-y-center">
<form bindsubmit="formSubmit" report-submit="true">
<form bindsubmit="onFormSubmit" report-submit="true">
<!-- 提现佣金 -->
<view class="widget widget__capital m-top20 b-f dis-flex flex-dir-column">
<view class="capital__item dis-flex flex-x-between flex-y-center">

View File

@ -66,6 +66,8 @@ Page({
has_error: false,
error_msg: '',
notRefresh: false, // 不允许刷新
},
/**
@ -86,7 +88,7 @@ Page({
onShow() {
let _this = this;
// 获取当前订单信息
_this.getOrderData();
!_this.data.notRefresh && _this.getOrderData();
},
/**
@ -185,10 +187,9 @@ Page({
*/
onSwichDelivery(e) {
// 设置当前配送方式
let _this = this,
curDelivery = e.currentTarget.dataset.current;
let _this = this;
_this.setData({
curDelivery
curDelivery: e.currentTarget.dataset.current
});
// 重新获取订单信息
_this.getOrderData();
@ -198,8 +199,14 @@ Page({
* 快递配送选择收货地址
*/
onSelectAddress() {
let _this = this;
// 允许刷新
_this.setData({
notRefresh: false
});
// 跳转到选择自提点
wx.navigateTo({
url: '../address/' + (this.data.exist_address ? 'index?from=flow' : 'create')
url: '../address/' + (_this.data.exist_address ? 'index?from=flow' : 'create')
});
},
@ -209,6 +216,11 @@ Page({
onSelectExtractPoint() {
let _this = this,
selectedId = _this.data.selectedShopId;
// 允许刷新
_this.setData({
notRefresh: false
});
// 跳转到选择自提点
wx.navigateTo({
url: '../_select/extract_point/index?selected_id=' + selectedId
});
@ -239,45 +251,9 @@ Page({
return false;
}
// 订单创建成功后回调--微信支付
let callback = result => {
if (result.code === -10) {
App.showError(result.msg, () => {
_this.redirectToOrderIndex();
});
return false;
}
// 发起微信支付
if (result.data.pay_type == PayTypeEnum.WECHAT.value) {
App.wxPayment({
payment: result.data.payment,
success: res => {
_this.redirectToOrderIndex();
},
fail: res => {
App.showError(result.msg.error, () => {
_this.redirectToOrderIndex();
});
},
});
}
// 余额支付
if (result.data.pay_type == PayTypeEnum.BALANCE.value) {
App.showSuccess(result.msg.success, () => {
_this.redirectToOrderIndex();
});
}
};
// 按钮禁用, 防止二次提交
_this.data.disabled = true;
// 显示loading
wx.showLoading({
title: '正在处理...'
});
let url = '';
@ -320,7 +296,7 @@ Page({
});
}
// 创建订单-砍价活动
// 创建订单-秒杀商品
if (options.order_type === 'sharp') {
url = 'sharp.order/checkout';
postData = Object.assign(postData, {
@ -331,17 +307,85 @@ Page({
});
}
// 提交到后端
const onCommitCallback = () => {
// 显示loading
wx.showLoading({
title: '正在处理...'
});
// 订单提交
App._post_form(url, postData, result => {
callback(result);
_this._onSubmitCallback(result);
}, result => {}, () => {
wx.hideLoading();
// 解除按钮禁用
_this.data.disabled = false;
});
// 不允许刷新
_this.setData({
notRefresh: true
});
};
// 请求用户订阅消息
_this._onRequestSubscribeMessage(onCommitCallback);
},
/**
* 请求用户订阅消息
*/
_onRequestSubscribeMessage(onCommitCallback) {
let _this = this,
tmplIds = _this.data.setting.order_submsg;
if (tmplIds.length == 0) {
onCommitCallback();
return;
}
wx.requestSubscribeMessage({
tmplIds,
success(res) {},
fail(res) {},
complete(res) {
onCommitCallback();
},
});
},
/**
* 订单提交成功后回调
*/
_onSubmitCallback(result) {
let _this = this;
// 订单创建成功后回调--微信支付
if (result.code === -10) {
App.showError(result.msg, () => {
_this.redirectToOrderIndex();
});
return false;
}
// 发起微信支付
if (result.data.pay_type == PayTypeEnum.WECHAT.value) {
App.wxPayment({
payment: result.data.payment,
success: res => {
_this.redirectToOrderIndex();
},
fail: res => {
App.showError(result.msg.error, () => {
_this.redirectToOrderIndex();
});
},
});
}
// 余额支付
if (result.data.pay_type == PayTypeEnum.BALANCE.value) {
App.showSuccess(result.msg.success, () => {
_this.redirectToOrderIndex();
});
}
},
/**
* 表单验证
*/

View File

@ -3,10 +3,6 @@ const App = getApp();
// 工具类
import Util from '../../utils/util.js';
// 引用直播组件
const livePlayer = requirePlugin('live-player-plugin');
// 直播状态
const LiveStatus = {
101: {
@ -104,6 +100,10 @@ Page({
* mix: 因livePlayer.getLiveStatus接口需要间隔1分钟频率轮询, 用户二次进入时体验不佳, 暂不调用
*/
setLiveStatusText(list) {
// 引用直播组件
const livePlayer = requirePlugin('live-player-plugin');
let _this = this;
let startIndex = _this.data.list.data.length - list.data.length;

View File

@ -7,46 +7,66 @@ Page({
*/
data: {
applyStatus: [],
isLoading: true,
dataType: -1,
page: 1,
no_more: false,
submsgSetting: {}, // 订阅消息配置
list: [], // 列表数据
page: 1, // 当前页码
isLoading: true, // 是否正在加载中
isLastPage: false, // 当前是最后一页
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad(options) {
let _this = this;
// 设置swiper的高度
this.setSwiperHeight();
_this.setSwiperHeight();
// 获取订阅消息配置
_this.getSubmsgSetting();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow() {
let _this = this;
// 获取退款/售后单列表
this.getRefundList();
_this.getRefundList();
},
/**
* 获取退款/售后单列表
*/
getRefundList: function(isNextPage, page) {
getRefundList(isNextPage, page) {
let _this = this;
App._get('user.refund/lists', {
state: _this.data.dataType,
page: page || 1,
}, function(result) {
}, (result) => {
// 创建页面数据
_this.setData(_this.createData(result.data, isNextPage));
});
},
/**
* 获取订阅消息配置
*/
getSubmsgSetting() {
let _this = this;
App._get('wxapp.submsg/setting', {}, (result) => {
_this.setData({
submsgSetting: result.data.setting
});
});
},
/**
* 创建页面数据
*/
createData: function(data, isNextPage) {
createData(data, isNextPage) {
data['isLoading'] = false;
// 列表数据
let dataList = this.data.list;
@ -67,7 +87,7 @@ Page({
/**
* 设置swiper的高度
*/
setSwiperHeight: function() {
setSwiperHeight() {
// 获取系统信息(拿到屏幕宽度)
let systemInfo = wx.getSystemInfoSync(),
rpx = systemInfo.windowWidth / 750, // 计算rpx
@ -81,7 +101,7 @@ Page({
/**
* 点击tab切换
*/
swichNav: function(e) {
swichNav(e) {
let _this = this,
current = e.target.dataset.current;
if (_this.data.dataType == current) {
@ -91,9 +111,9 @@ Page({
dataType: current,
list: {},
page: 1,
no_more: false,
isLastPage: false,
isLoading: true,
}, function() {
}, () => {
// 获取退款/售后单列表
_this.getRefundList();
});
@ -102,25 +122,50 @@ Page({
/**
* 下拉到底加载数据
*/
triggerDownLoad: function() {
onPageDown() {
let _this = this;
// 已经是最后一页
if (this.data.page >= this.data.list.last_page) {
this.setData({
no_more: true
if (_this.data.page >= _this.data.list.last_page) {
_this.setData({
isLastPage: true
});
return false;
}
// 获取退款/售后单列表
this.getRefundList(true, ++this.data.page);
_this.getRefundList(true, ++_this.data.page);
},
/**
* 跳转售后详情页
*/
triggerDetail: function(e) {
onTargetDetail(e) {
let _this = this;
// 跳转售后详情页
const onCallback = () => {
wx.navigateTo({
url: './detail/detail?order_refund_id=' + e.currentTarget.dataset.id
url: `./detail/detail?order_refund_id=${e.currentTarget.dataset.id}`
});
};
// 请求用户订阅消息
_this._onRequestSubscribeMessage(onCallback);
},
/**
* 订阅消息 => [售后状态通知]
*/
_onRequestSubscribeMessage(callback) {
let _this = this;
let tmplItem = _this.data.submsgSetting.order.refund.template_id;
if (tmplItem.length > 0) {
wx.requestSubscribeMessage({
tmplIds: [tmplItem],
success(res) {},
fail(res) {},
complete(res) {
callback && callback();
},
});
}
},
})

View File

@ -6,7 +6,7 @@
</block>
</view>
<!-- 退款/售后单 -->
<scroll-view scroll-y="{{ true }}" bindscrolltolower="triggerDownLoad" style="height: {{swiperHeight}}px;">
<scroll-view scroll-y="{{ true }}" bindscrolltolower="onPageDown" style="height: {{swiperHeight}}px;">
<view class="widget-list" wx:if="{{ list.data.length }}">
<view class="widget-detail" wx:for="{{ list.data }}" wx:key="this" catchtap="triggerDetail" data-id="{{ item.order_refund_id }}">
<view class="row-block dis-flex flex-y-center">
@ -42,11 +42,11 @@
</view>
</view>
<view class="detail-operate row-block dis-flex flex-x-end flex-y-center">
<view class="detail-btn btn-detail" catchtap="triggerDetail" data-id="{{ item.order_refund_id }}">查看详情</view>
<view class="detail-btn btn-detail" catchtap="onTargetDetail" data-id="{{ item.order_refund_id }}">查看详情</view>
</view>
</view>
<!-- 没有更多 -->
<view wx:if="{{ list.data.length && !isLoading && no_more }}" class="no-more f-30">亲, 没有更多了</view>
<view wx:if="{{ list.data.length && !isLoading && isLastPage }}" class="no-more f-30">亲, 没有更多了</view>
</view>
<!-- 没有记录 -->
<view class="yoshop-notcont" wx:if="{{ !list.data.length && !isLoading }}">

View File

@ -40,6 +40,33 @@ Page({
_this.getSetting();
},
/**
* 点击立即分享,请求订阅消息
*/
onShare() {
let _this = this;
_this._onRequestSubscribeMessage();
},
/**
* 订阅消息 => [拼团进度通知]
*/
_onRequestSubscribeMessage(callback) {
let _this = this;
let tmplItem = _this.data.setting.order_submsg.active_status;
if (tmplItem.length > 0) {
wx.requestSubscribeMessage({
tmplIds: [tmplItem],
success(res) {},
fail(res) {},
complete(res) {
callback && callback();
},
});
}
},
/**
* 获取拼团详情
*/
@ -315,7 +342,7 @@ Page({
},
/**
* 加入购物车and立即购买
* 立即参团
*/
onCheckout(e) {
let _this = this;
@ -323,7 +350,8 @@ Page({
if (!_this._onVerify()) {
return false;
}
// 立即购买
// 立即参团
const onCommitCallback = () => {
wx.navigateTo({
url: '../checkout/index?' + util.urlEncode({
order_type: 20,
@ -333,6 +361,9 @@ Page({
goods_sku_id: _this.data.goods_sku_id,
})
});
};
// 请求用户订阅消息
_this._onRequestSubscribeMessage(onCommitCallback);
},
/**
@ -361,8 +392,8 @@ Page({
onPreviewSkuImage(e) {
let _this = this;
wx.previewImage({
current: _this.data.image_path,
urls: [_this.data.image_path]
current: _this.data.skuCoverImage,
urls: [_this.data.skuCoverImage]
})
},

View File

@ -66,7 +66,7 @@
<!-- 操作按钮 -->
<block wx:if="{{ detail.status.value == 10 }}">
<button wx:if="{{ !is_join }}" catchtap="onTriggerOrder">立即参团</button>
<button wx:else open-type="share">立即分享</button>
<button wx:else open-type="share" catchtap="onShare">立即分享</button>
</block>
<button wx:else catchtap="onTargetGoods">去开团</button>
</view>

View File

@ -63,6 +63,8 @@ Page({
has_error: false,
error_msg: '',
notRefresh: false, // 不允许刷新
},
/**
@ -80,7 +82,7 @@ Page({
onShow() {
let _this = this;
// 获取当前订单信息
_this.getOrderData();
!_this.data.notRefresh && _this.getOrderData();
},
/**
@ -106,7 +108,7 @@ Page({
// 当前选择的配送方式
data.curDelivery = resData.delivery;
// 如果只有一种配送方式则不显示选项卡
data.isShowTab = resData.deliverySetting.length > 1;
data.isShowTab = resData.setting.delivery.length > 1;
// 上门自提联系信息
if (_this.data.linkman === '') {
data.linkman = resData.last_extract.linkman;
@ -154,8 +156,14 @@ Page({
* 快递配送选择收货地址
*/
onSelectAddress() {
let _this = this;
// 允许刷新
_this.setData({
notRefresh: false
});
// 跳转到选择自提点
wx.navigateTo({
url: '../../address/' + (this.data.exist_address ? 'index?from=flow' : 'create')
url: '../../address/' + (_this.data.exist_address ? 'index?from=flow' : 'create')
});
},
@ -165,6 +173,11 @@ Page({
onSelectExtractPoint() {
let _this = this,
selectedId = _this.data.selectedShopId;
// 允许刷新
_this.setData({
notRefresh: false
});
// 跳转到选择自提点
wx.navigateTo({
url: '../../_select/extract_point/index?selected_id=' + selectedId
});
@ -195,8 +208,72 @@ Page({
return false;
}
// 按钮禁用, 防止二次提交
_this.data.disabled = true;
// 提交到后端
const onCommitCallback = () => {
// 显示loading
wx.showLoading({
title: '正在处理...'
});
// 创建订单-立即购买
App._post_form('sharing.order/checkout', {
order_type: options.order_type || 10,
goods_id: options.goods_id,
goods_num: options.goods_num,
goods_sku_id: options.goods_sku_id,
delivery: _this.data.curDelivery || 0,
pay_type: _this.data.curPayType,
shop_id: _this.data.selectedShopId || 0,
linkman: _this.data.linkman,
phone: _this.data.phone,
active_id: options.active_id || 0,
coupon_id: _this.data.selectCouponId || 0,
is_use_points: _this.data.isUsePoints ? 1 : 0,
remark: _this.data.remark || '',
}, result => {
_this._onSubmitCallback(result);
}, result => {}, () => {
wx.hideLoading();
// 解除按钮禁用
_this.data.disabled = false;
// 不允许刷新
_this.setData({
notRefresh: true
});
});
};
// 请求用户订阅消息
_this._onRequestSubscribeMessage(onCommitCallback);
},
/**
* 请求用户订阅消息
*/
_onRequestSubscribeMessage(onCommitCallback) {
let _this = this,
tmplIds = _this.data.setting.order_submsg;
if (tmplIds.length == 0) {
onCommitCallback();
return;
}
wx.requestSubscribeMessage({
tmplIds,
success(res) {},
fail(res) {},
complete(res) {
onCommitCallback();
},
});
},
/**
* 订单提交成功后回调
*/
_onSubmitCallback(result) {
let _this = this;
// 订单创建成功后回调--微信支付
let callback = result => {
if (result.code === -10) {
App.showError(result.msg, () => {
_this.redirectToOrderIndex();
@ -223,45 +300,6 @@ Page({
_this.redirectToOrderIndex();
});
}
};
// 按钮禁用, 防止二次提交
_this.data.disabled = true;
// 显示loading
wx.showLoading({
title: '正在处理...'
});
// 创建订单-立即购买
App._post_form('sharing.order/checkout', {
order_type: options.order_type || 10,
goods_id: options.goods_id,
goods_num: options.goods_num,
goods_sku_id: options.goods_sku_id,
delivery: _this.data.curDelivery || 0,
pay_type: _this.data.curPayType,
shop_id: _this.data.selectedShopId || 0,
linkman: _this.data.linkman,
phone: _this.data.phone,
active_id: options.active_id || 0,
coupon_id: _this.data.selectCouponId || 0,
is_use_points: _this.data.isUsePoints ? 1 : 0,
remark: _this.data.remark || '',
}, result => {
// success
console.log('success');
callback(result);
}, result => {
// fail
console.log('fail');
}, () => {
// complete
console.log('complete');
wx.hideLoading();
// 解除按钮禁用
_this.data.disabled = false;
});
},
/**

View File

@ -345,8 +345,8 @@ Page({
onPreviewSkuImage(e) {
let _this = this;
wx.previewImage({
current: _this.data.image_path,
urls: [_this.data.image_path]
current: _this.data.skuCoverImage,
urls: [_this.data.skuCoverImage]
})
},

View File

@ -7,46 +7,66 @@ Page({
*/
data: {
applyStatus: [],
isLoading: true,
dataType: -1,
page: 1,
no_more: false,
submsgSetting: {}, // 订阅消息配置
list: [], // 列表数据
page: 1, // 当前页码
isLoading: true, // 是否正在加载中
isLastPage: false, // 当前是最后一页
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad(options) {
let _this = this;
// 设置swiper的高度
this.setSwiperHeight();
_this.setSwiperHeight();
// 获取订阅消息配置
_this.getSubmsgSetting();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow() {
let _this = this;
// 获取退款/售后单列表
this.getRefundList();
_this.getRefundList();
},
/**
* 获取退款/售后单列表
*/
getRefundList: function(isNextPage, page) {
getRefundList(isNextPage, page) {
let _this = this;
App._get('sharing.refund/lists', {
state: _this.data.dataType,
page: page || 1,
}, function(result) {
}, (result) => {
// 创建页面数据
_this.setData(_this.createData(result.data, isNextPage));
});
},
/**
* 获取订阅消息配置
*/
getSubmsgSetting() {
let _this = this;
App._get('wxapp.submsg/setting', {}, (result) => {
_this.setData({
submsgSetting: result.data.setting
});
});
},
/**
* 创建页面数据
*/
createData: function(data, isNextPage) {
createData(data, isNextPage) {
data['isLoading'] = false;
// 列表数据
let dataList = this.data.list;
@ -67,7 +87,7 @@ Page({
/**
* 设置swiper的高度
*/
setSwiperHeight: function() {
setSwiperHeight() {
// 获取系统信息(拿到屏幕宽度)
let systemInfo = wx.getSystemInfoSync(),
rpx = systemInfo.windowWidth / 750, // 计算rpx
@ -81,7 +101,7 @@ Page({
/**
* 点击tab切换
*/
swichNav: function(e) {
swichNav(e) {
let _this = this,
current = e.target.dataset.current;
if (_this.data.dataType == current) {
@ -91,9 +111,9 @@ Page({
dataType: current,
list: {},
page: 1,
no_more: false,
isLastPage: false,
isLoading: true,
}, function() {
}, () => {
// 获取退款/售后单列表
_this.getRefundList();
});
@ -102,25 +122,50 @@ Page({
/**
* 下拉到底加载数据
*/
triggerDownLoad: function() {
onPageDown() {
let _this = this;
// 已经是最后一页
if (this.data.page >= this.data.list.last_page) {
this.setData({
no_more: true
if (_this.data.page >= _this.data.list.last_page) {
_this.setData({
isLastPage: true
});
return false;
}
// 获取退款/售后单列表
this.getRefundList(true, ++this.data.page);
_this.getRefundList(true, ++_this.data.page);
},
/**
* 跳转售后详情页
*/
triggerDetail: function(e) {
onTargetDetail(e) {
let _this = this;
// 跳转售后详情页
const onCallback = () => {
wx.navigateTo({
url: './detail/detail?order_refund_id=' + e.currentTarget.dataset.id
url: `./detail/detail?order_refund_id=${e.currentTarget.dataset.id}`
});
};
// 请求用户订阅消息
_this._onRequestSubscribeMessage(onCallback);
},
/**
* 订阅消息 => [售后状态通知]
*/
_onRequestSubscribeMessage(callback) {
let _this = this;
let tmplItem = _this.data.submsgSetting.order.refund.template_id;
if (tmplItem.length > 0) {
wx.requestSubscribeMessage({
tmplIds: [tmplItem],
success(res) {},
fail(res) {},
complete(res) {
callback && callback();
},
});
}
},
})

View File

@ -6,7 +6,7 @@
</block>
</view>
<!-- 退款/售后单 -->
<scroll-view scroll-y="{{ true }}" bindscrolltolower="triggerDownLoad" style="height: {{swiperHeight}}px;">
<scroll-view scroll-y="{{ true }}" bindscrolltolower="onPageDown" style="height: {{swiperHeight}}px;">
<view class="widget-list" wx:if="{{ list.data.length }}">
<view class="widget-detail" wx:for="{{ list.data }}" wx:key="this" catchtap="triggerDetail" data-id="{{ item.order_refund_id }}">
<view class="row-block dis-flex flex-y-center">
@ -36,11 +36,11 @@
<text class="col-m">¥{{ item.order_goods.total_pay_price }}</text>
</view>
<view class="detail-operate row-block dis-flex flex-x-end flex-y-center">
<view class="detail-btn btn-detail" catchtap="triggerDetail" data-id="{{ item.order_refund_id }}">查看详情</view>
<view class="detail-btn btn-detail" catchtap="onTargetDetail" data-id="{{ item.order_refund_id }}">查看详情</view>
</view>
</view>
<!-- 没有更多 -->
<view wx:if="{{ list.data.length && !isLoading && no_more }}" class="no-more f-30">亲, 没有更多了</view>
<view wx:if="{{ list.data.length && !isLoading && isLastPage }}" class="no-more f-30">亲, 没有更多了</view>
</view>
<!-- 没有记录 -->
<view class="yoshop-notcont" wx:if="{{ !list.data.length && !isLoading }}">

View File

@ -1,4 +1,4 @@
let App = getApp();
const App = getApp();
/**
* 拼团扩展类

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
{
"version": "1.1.40"
"version": "1.1.41"
}