Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-limited-sell-miniapp
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
baoss
5 years ago
Commit
f15166326a604a3196954c4726379031359a1c65
1 parent
3111f3bd
master
...
feature/dev-6.9.19
feature/dev-6.9.19-hotfix
删除模板消息 增加订阅消息 review by bevishuang
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
91 additions
and
87 deletions
app/common/config.js
app/models/common.js
app/pages/product/detail/detail.js
app/pages/product/detail/detail.wxml
app/pages/product/detail/detail.wxss
app/pages/queue/index.js
app/pages/queue/index.wxml
app/pages/queue/myList.js
app/pages/queue/myList.wxml
app/utils/wechat-pay.js
app/common/config.js
View file @
f151663
const
config
=
{
domains
:
{
// production
api
:
'https://api.yoho.cn'
,
service
:
'https://api.yoho.cn'
,
// api: 'https://api.yoho.cn',
// service: 'https://api.yoho.cn',
// gray
// api: 'http://apigray.yoho.cn',
// store: 'http://openstore.yohops.com',
// test
// api: 'http://api-test3.dev.yohocorp.com',
// service: 'http://api-test3.dev.yohocorp.com',
api
:
'http://api-test3.dev.yohocorp.com'
,
service
:
'http://api-test3.dev.yohocorp.com'
,
yasApi
:
'https://analysis.yohobuy.com/yas_mobile'
},
...
...
app/models/common.js
View file @
f151663
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,48 @@ 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
)
}
})
})
}
};
...
...
app/pages/product/detail/detail.js
View file @
f151663
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
;
...
...
@@ -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
:
''
;
...
...
@@ -545,13 +545,6 @@ Page(Object.assign({
return
;
}
common
.
addWechatFormId
({
formId
:
e
.
detail
.
formId
,
uid
:
this
.
data
.
uid
,
miniapp_type
:
app
.
getMiniappType
(),
openId
:
app
.
getOpenID
()
});
this
.
share
();
},
assistAction
()
{
...
...
@@ -710,6 +703,21 @@ 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
();
},
...
...
app/pages/product/detail/detail.wxml
View file @
f151663
...
...
@@ -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">
...
...
app/pages/product/detail/detail.wxss
View file @
f151663
...
...
@@ -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
...
...
app/pages/queue/index.js
View file @
f151663
...
...
@@ -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
...
...
app/pages/queue/index.wxml
View file @
f151663
...
...
@@ -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}}'>
...
...
app/pages/queue/myList.js
View file @
f151663
...
...
@@ -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
()
});
},
/**
* 获取排队列表
...
...
app/pages/queue/myList.wxml
View file @
f151663
...
...
@@ -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
...
...
app/utils/wechat-pay.js
View file @
f151663
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
);
...
...
Please
register
or
login
to post a comment