Authored by 黄敬囿

Merge branch 'feature/dev-6.9.19' into 'master'

Feature/dev 6.9.19

订阅消息

See merge request !18
import api from '../common/api';
import config from '../common/config.js';
export default {
/**
* 添加微信模版消息FormId
* @param params
* @returns {*}
*/
addWechatFormId(params) {
return api.get({
data: Object.assign({
method: 'wechat.formId.add'
}, params)
});
},
getUnionTypeWithUid(uid) {
let param = {
method: 'app.union.shareOrder.queryUnionTypeByUid',
... ... @@ -24,5 +11,55 @@ export default {
data: param,
code: 200
});
},
postTmplId(params) {
let app = getApp();
let that = this;
// 如果没有uid,不上报,否则接口报500
if (!app.getUid() || params.tmplIds.length === 0) {
return;
}
return new Promise(resolve => {
wx.requestSubscribeMessage({
tmplIds: params.tmplIds,
success(res) {
console.log(res);
let tmplIds = res;
delete tmplIds.errMsg;
tmplIds = JSON.stringify(tmplIds);
// 上报tmplIds
let tmplIdParams = {
uid: app.getUid(),
openId: app.getOpenID(),
miniAppType: config.mini_app_type,
templateIds: tmplIds,
method: 'mini.subscribe.add',
};
console.log('params', tmplIdParams);
api.get({
data: tmplIdParams
}).then(res => {
resolve(res);
});
},
fail(res) {
console.log(res);
wx.showToast({
title: res.errCode === 20004 ? '消息未开启 请点击右上角,打开设置,开启消息' : res.errMsg,
icon: 'none',
duration: 3000,
});
setTimeout(function() {
resolve();
}, 3000);
}
});
});
}
};
... ...
... ... @@ -134,7 +134,7 @@ Page({
}
that.setData({
listData: list,
footText: list.length > 0 ? '':'暂无更多内容'
footText: list.length > 0 ? '' : '暂无更多内容'
});
}
});
... ...
import detailModel from '../../../models/product/detail';
import formatImage from '../../../utils/formatImage';
import config from '../../../common/config';
import common from '../../../models/common';
import Yas from '../../../common/yas';
import {
... ... @@ -12,7 +11,7 @@ import {
stringify
} from '../../../vendors/query-stringify';
import wx from '../../../utils/wx';
import commonService from '../../../models/common.js';
let app = getApp();
let router = global.router;
let yas;
... ... @@ -81,7 +80,7 @@ const QUEUE_SUCCESS = {
const OFFLINE_STATUS = {
OFFLINE: 1,
OFFLINE_OVER: 0
}
};
const YB_TO_ASSIST_C = 'YB_TO_ASSIST_C';
const YB_ASSIST_SUCCESS_L = 'YB_ASSIST_SUCCESS_L';
const YB_INVITE_ASSIST_C = 'YB_INVITE_ASSIST_C';
... ... @@ -140,6 +139,7 @@ Page(Object.assign({
image_src: '../../../static/images/share_wxpeng@2x.png'
}]
},
isFollow: false
},
onLoad: function(query) {
let limitProductCode = query.limitProductCode ? query.limitProductCode : '';
... ... @@ -168,8 +168,9 @@ Page(Object.assign({
});
let userInfo = app.getUserInfo();
if (!userInfo.wechat || !this.getUserWechatId()) {
this.goLogin({'login': '0', 'type': 'redirectTo'});
this.goLogin({login: '0', type: 'redirectTo'});
return;
}
... ... @@ -545,20 +546,13 @@ Page(Object.assign({
return;
}
common.addWechatFormId({
formId: e.detail.formId,
uid: this.data.uid,
miniapp_type: app.getMiniappType(),
openId: app.getOpenID()
});
this.share();
},
assistAction() {
let userInfo = app.getUserInfo();
if (!userInfo.wechat || !this.getUserWechatId()) {
this.goLogin({'login': '0'});
this.goLogin({login: '0'});
return;
}
... ... @@ -622,7 +616,7 @@ Page(Object.assign({
let userInfo = app.getUserInfo();
if (!userInfo.wechat || !this.getUserWechatId()) {
this.goLogin({'login': '0'});
this.goLogin({login: '0'});
return;
}
... ... @@ -710,6 +704,23 @@ Page(Object.assign({
}
});
},
toFollow() {
let that = this;
if (this.data.isFollow) {
return;
}
let tmplIds = ['WhCBCAO2ci_gSrDSzpMExhYAdnhlF0aqgr2YWzJG4EM', '3KKWG1j-1ui2wE19aLcpCVSoKTsbWpnlmPIBLesHJqs'];
commonService.postTmplId({
tmplIds
}).then(res => {
that.setData({
isFollow: true
});
});
},
assistCancel() {
this.reload();
},
... ... @@ -785,8 +796,8 @@ Page(Object.assign({
},
goLogin(params) {
let login = parseInt(params['login']) || 1;
let type = params['type'] || 'navigateTo';
let login = parseInt(params.login) || 1;
let type = params.type || 'navigateTo';
let data = {};
if (this.data.originUid) {
... ...
... ... @@ -24,6 +24,7 @@
</view> -->
<view class="realPrice">{{price}}</view>
<view class="advanceTitle">{{reminderNum}}人已关注</view>
<view class="follow-btn {{isFollow ? 'followed': 'follow'}}" bindtap="toFollow">{{isFollow ? '已关注':'关注'}}</view>
</view>
<view class="detail-btn" bindtap="buyNow">查看商品详情</view>
</view>
... ... @@ -66,18 +67,16 @@
<block wx:if="{{productSourceType === 1}}">
<action-bar wx:if="{{assistStatus === 1 || assistStatus === 3}}">
<form bindsubmit="assistShare" report-submit='true'>
<view class="bottom1-action">
<block wx:if="{{offlineStatus === 1}}">
<button class="as-bottom ok1" formType="submit">{{isNew=='Y' ? '邀请新用户助力获取限购码' : '邀请好友助力获取限购码'}}
<button class="as-bottom ok1">{{isNew=='Y' ? '邀请新用户助力获取限购码' : '邀请好友助力获取限购码'}}
<text class="buy-tip"> (线下购买专用)</text></button>
</block>
<button wx:else class="as-bottom ok" formType="submit">{{isNew=='Y' ? '邀请新用户助力获取限购码' : '邀请好友助力获取限购码'}}</button>
<button wx:else class="as-bottom ok">{{isNew=='Y' ? '邀请新用户助力获取限购码' : '邀请好友助力获取限购码'}}</button>
<view class="help-wrapper" bindtap="goHelp">
<image class="help" src="../../../static/images/XD_q_ic@3x.png"></image>
</view>
</view>
</form>
</action-bar>
<action-bar wx:elif="{{assistStatus === 2}}">
<view class="bottom1-action">
... ...
... ... @@ -56,6 +56,7 @@
height: 40rpx;
font-size: 36rpx;
font-weight: bold;
flex: 1;
}
.detail-btn {
... ... @@ -286,4 +287,22 @@
.appBtn .appImg {
width: 80rpx;
height: 160rpx;
}
.follow-btn {
font-size: 24rpx;
border-radius: 40rpx;
padding: 0 20rpx;
line-height: 38rpx;
height: 40rpx;
box-sizing: border-box;
margin-left: 10rpx;
}
.follow {
color: #444;
border: solid 1px #444400;
}
.followed {
color: #B0B0B0;
border: solid 1px #B3B3B3;
}
\ No newline at end of file
... ...
... ... @@ -10,7 +10,6 @@ import {
import {
stringify
} from '../../vendors/query-stringify';
import commonModel from '../../models/common';
import Yas from '../../common/yas';
let app = getApp();
... ... @@ -690,22 +689,6 @@ Page(Object.assign({
}
},
/**
* 提交formId消息模板
*/
submitFormId: function(e) {
console.log('submitFormId:', {
formId: e.detail.formId,
uid: app.getUid() || 0,
openId: app.getOpenID() || ''
});
commonModel.addWechatFormId({
formId: e.detail.formId,
uid: app.getUid() || 0,
openId: app.getOpenID() || '',
miniapp_type: app.getMiniappType()
});
},
/**
* 处理接口返回的图片url
... ...
... ... @@ -80,13 +80,11 @@
</block>
<!--如果活动正在进行中-->
<block wx:elif='{{activityInfo.isBegin === 1 && !activityInfo.isEnd}}'>
<form bindsubmit='submitFormId' report-submit='true'>
<view class='button-container'>
<button class='join-button' bindtap='joinInQueue' form-type='submit'>
<button class='join-button' bindtap='joinInQueue'>
<text>参加活动</text>
</button>
</view>
</form>
</block>
<!--活动即将开始-->
<block wx:elif='{{!activityInfo.isBegin}}'>
... ...
... ... @@ -7,7 +7,6 @@ import wx from '../../utils/wx';
import {
Actionsheet
} from '../../vendors/zanui/index';
import commonModel from '../../models/common';
import Yas from '../../common/yas';
import {
stringify
... ... @@ -275,22 +274,6 @@ Page(Object.assign({
this.share();
},
/**
* 提交formId消息模板
*/
submitFormId: function(e) {
console.log('submitFormId:', {
formId: e.detail.formId,
uid: app.getUid() || 0,
openId: app.getOpenID() || ''
});
commonModel.addWechatFormId({
formId: e.detail.formId,
uid: app.getUid() || 0,
openId: app.getOpenID() || '',
miniapp_type: app.getMiniappType()
});
},
/**
* 获取排队列表
... ...
... ... @@ -48,10 +48,8 @@
</view>
</view>
</block>
<form bindsubmit='submitFormId' report-submit='true'>
<button wx:if='{{!isEnd}}' class='invite-button' hidden='{{hideInviteButton}}' form-type='submit' bindtap='inviteFriends'>
<button wx:if='{{!isEnd}}' class='invite-button' hidden='{{hideInviteButton}}' bindtap='inviteFriends'>
{{isNew=='Y' ? '邀请新用户助力排队' : '邀请好友助力排队'}}
</button>
</form>
</view>
<template is="zan-actionsheet" data="{{...actionSheet}}" />
\ No newline at end of file
... ...
import payModel from '../models/pay/pay';
import commonModel from '../models/common';
import Yas from '../common/yas';
const PAYMENT_CODE = '56'; // 红人分销支付类型
... ... @@ -98,20 +97,7 @@ function wechatPay(order) {
signType: data.signType,
paySign: data.paySign,
success: function() {
let prepareID = data.package;
if (prepareID && prepareID.length > 10) {
prepareID = prepareID.slice(10);
// 上报formID
commonModel.addWechatFormId({
order_code: orderCode,
openId: app.getOpenID(),
miniapp_type: app.getMiniappType(),
formId: prepareID,
formType: 'pay',
});
}
reportPayStatus(orderCode, orderAmount, true);
... ...