提交 59d8a097 编写于 作者: api工厂's avatar api工厂

微信登陆授权机制调整

上级 fd6168d9
......@@ -65,7 +65,7 @@ App({
wx.hideToast()
}
})
WXAPI.queryConfigBatch('mallName,WITHDRAW_MIN,ALLOW_SELF_COLLECTION,order_hx_uids,subscribe_ids,share_profile,adminUserIds,goodsDetailSkuShowType,shopMod,needIdCheck,balance_pay_pwd,shipping_address_gps,shipping_address_region_level,shopping_cart_vop_open').then(res => {
WXAPI.queryConfigBatch('mallName,WITHDRAW_MIN,ALLOW_SELF_COLLECTION,order_hx_uids,subscribe_ids,share_profile,adminUserIds,goodsDetailSkuShowType,shopMod,needIdCheck,balance_pay_pwd,shipping_address_gps,shipping_address_region_level,shopping_cart_vop_open,show_wx_quanzi').then(res => {
if (res.code == 0) {
res.data.forEach(config => {
wx.setStorageSync(config.key, config.value);
......
......@@ -11,6 +11,7 @@
"pages/goods/fav",
"pages/goods-details/index",
"pages/goods-details/vop",
"pages/goods-details/cps-jd",
"pages/shop-cart/index",
"pages/to-pay-order/index",
"pages/select-address/index",
......
@import 'weui/weui.wxss';
@import "/miniprogram_npm/@vant/weapp/common/index.wxss";
.container {
display: flex;
......
module.exports = {
version: '11.3.2',
note: '直播推拉流', // 这个为版本描述,无需修改
version: '11.4.0',
note: '微信登陆授权机制调整', // 这个为版本描述,无需修改
subDomain: 'tz', // liu123 此处改成你自己的专属域名。什么是专属域名?请看教程 https://www.it120.cc/help/qr6l4m.html
merchantId: 951, // 商户ID,可在后台工厂设置-->商户信息查看
sdkAppID: 1400450467, // 腾讯实时音视频应用编号,请看教程 https://www.it120.cc/help/nxoqsl.html
......
......@@ -95,7 +95,7 @@ module.exports =
/* eslint-disable */
// 小程序开发api接口工具包,https://github.com/gooking/wxapi
var API_BASE_URL = 'https://api.it120.cc';
// var API_BASE_URL = 'http://127.0.0.1:8081';
// var API_BASE_URL = 'http://127.0.0.1:8081';
var subDomain = '-';
var merchantId = '0';
......@@ -1620,7 +1620,10 @@ module.exports = {
return request('/jdvop/' + merchantId + '/shopping-cart/empty', false, 'post', {
token: token
});
}
},
cpsJdGoodsDetail: data => {
return request('/cpsJdGoods/detail', true, 'get', data)
},
};
/***/ })
......
......@@ -96,14 +96,25 @@ Page({
}).exec();
},
// 主推商品详情
toDetail(e) {
let {
id
} = e.currentTarget.dataset
let url = `/pages/goods-details/index?id=${id}`
wx.navigateTo({
url,
})
async toDetail(e) {
const id = e.currentTarget.dataset.id
const res = await WXAPI.goodsDetail(id, wx.getStorageSync('token'))
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
if (res.data.basicInfo.supplyType == 'cps_jd') {
wx.navigateTo({
url: `/pages/goods-details/cps-jd?id=${id}`,
})
} else {
wx.navigateTo({
url: `/pages/goods-details/index?id=${id}`,
})
}
},
preventDefault() {
......
......@@ -122,18 +122,27 @@ Page({
}).exec();
},
// 主推商品详情
toDetail(e) {
let {
id
} = e.currentTarget.dataset
let url = `/pages/goods-details/index?id=${id}`
wx.navigateTo({
url,
})
async toDetail(e) {
const id = e.currentTarget.dataset.id
const res = await WXAPI.goodsDetail(id, wx.getStorageSync('token'))
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
if (res.data.basicInfo.supplyType == 'cps_jd') {
wx.navigateTo({
url: `/pages/goods-details/cps-jd?id=${id}`,
})
} else {
wx.navigateTo({
url: `/pages/goods-details/index?id=${id}`,
})
}
},
async handleLikeClick() {
await WXAPI.likeLiveRoom(wx.getStorageSync('token'), this.data.id)
this.sendSocketMessage('act:like')
......@@ -221,62 +230,6 @@ Page({
}
},
// getGoodsList() {
// return
// let data = this.data
// if (!data.hasMore) return
// api.get({
// url: '/wxsmall/Live/liveCart',
// data: {
// number: data.number,
// page: data.pageIndex++,
// pagesize: data.pageSize
// },
// success: res => {
// console.log(res)
// let ret = res.data
// let len = ret.length
// let emptyFlag = false
// let moreFlag = true
// if (!len && data.pageIndex == 2) { // 空数组
// emptyFlag = true
// }
// if (len < data.pageSize) { // 没有更多数据
// moreFlag = false
// }
// let originalList = [...data.goodsList]
// this.setData({
// total: res.total,
// goodsList: originalList.concat(ret),
// hasMore: moreFlag ? true : false,
// showEmpty: emptyFlag ? true : false
// })
// }
// })
// },
// navCart() {
// let url = `/pages/cart/cart`
// wx.navigateTo({
// url,
// })
// },
// navPurchase(e) {
// let { number } = this.data // number表明来自于当前主播
// let url = `/pages/product-detail/index?id=${e.currentTarget.dataset.id}&number=${number}`
// wx.navigateTo({
// url,
// })
// },
// 前往商品详情
navPurchase(e) {
wx.navigateTo({
url: "/pages/goods-details/index?id=" + e.currentTarget.dataset.id
})
},
async getLiveInfo() {
const res = await WXAPI.liveRoomsInfo(wx.getStorageSync('token'), this.data.id)
if (res.code != 0) {
......
......@@ -123,7 +123,7 @@
<cover-view class="goods-title">{{ item.name }}</cover-view>
<cover-view class="price">¥{{ item.minPrice }}</cover-view>
</cover-view>
<button class="btn" catchtap="navPurchase" data-id="{{ item.id }}">去购买</button>
<button class="btn" catchtap="toDetail" data-id="{{ item.id }}">去购买</button>
</cover-view>
</block>
</cover-view>
......
......@@ -159,8 +159,6 @@ Page({
page: 1
})
this.queryLiveRoomInfo()
// 调用getUserInfo接口
//app.getUserInfo()
wx.stopPullDownRefresh()
},
......
......@@ -140,20 +140,10 @@ Page({
AUTH.checkHasLogined().then(isLogined => {
this.data.isLogined = isLogined
if (!isLogined) {
AUTH.openLoginDialog()
AUTH.login(this)
}
})
},
processLogin(e) {
if (!e.detail.userInfo) {
wx.showToast({
title: '已取消',
icon: 'none',
})
return;
}
AUTH.register(this);
},
async initTrtc () {
const res = await WXAPI.trtcUserSig(wx.getStorageSync('token'))
if (res.code == 0) {
......
......@@ -42,8 +42,4 @@
</view>
</view>
</view>
</view>
<van-dialog id="van-dialog-auth-login" bind:getuserinfo="processLogin" />
\ No newline at end of file
</view>
\ No newline at end of file
......@@ -178,14 +178,4 @@ Page({
url: '/pages/my/index'
})
},
processLogin(e){
if (!e.detail.userInfo) {
wx.showToast({
title: '已取消',
icon: 'none',
})
return;
}
AUTH.register(this);
},
})
\ No newline at end of file
......@@ -202,7 +202,7 @@ Page({
// 处理加入购物车的业务逻辑
this.addShopCarDone(options)
} else {
AUTH.openLoginDialog()
AUTH.login(this)
}
})
},
......@@ -330,8 +330,13 @@ Page({
if (needSelectNum == curSelectNum) {
canSubmit = true;
}
const token = wx.getStorageSync('token')
if (canSubmit) {
const res = await WXAPI.goodsPrice(this.data.skuCurGoods.basicInfo.id, propertyChildIds)
const res = await WXAPI.goodsPriceV2({
token: token ? token : '',
goodsId: this.data.skuCurGoods.basicInfo.id,
propertyChildIds: propertyChildIds
})
if (res.code == 0) {
price = res.data.price
originalPrice = res.data.originalPrice
......@@ -375,16 +380,6 @@ Page({
}
this.addShopCarDone(options)
},
processLogin(e) {
if (!e.detail.userInfo) {
wx.showToast({
title: '已取消',
icon: 'none',
})
return;
}
AUTH.register(this);
},
goodsGoBottom() {
this.data.page++
this.getGoodsList()
......
......@@ -30,14 +30,25 @@
</view>
</view> -->
<!-- 显示右侧商品 -->
<wxs module="goodsDetailPage">
module.exports = {
url : function(item) {
if (item.supplyType == 'cps_jd') {
return '/pages/goods-details/cps-jd?id=' + item.id
} else {
return '/pages/goods-details/index?id=' + item.id
}
}
}
</wxs>
<van-card
wx:for="{{currentGoods}}" wx:key="id"
price="{{item.minPrice}}"
desc="{{item.numberSells ? '已售' + item.numberSells : ''}}"
tag="{{item.gotScore ? item.gotScore + '积分' : ''}}"
title="{{item.name}}"
thumb="{{item.pic}}_m"
thumb-link="/pages/goods-details/index?id={{item.id}}"
thumb="{{item.pic}}"
thumb-link="{{ goodsDetailPage.url(item) }}"
>
<view class="goods-btn" slot="footer">
<van-icon wx:if="{{ item.propertyIds || item.hasAddition }}" name="add" color="#e64340" size="48rpx" data-id="{{item.id}}" bind:click="addShopCar" />
......@@ -75,5 +86,3 @@
</view>
<van-button type="danger" block bind:click="addCarSku">加入购物车</van-button>
</van-popup>
<van-dialog id="van-dialog-auth-login" bind:getuserinfo="processLogin" />
\ No newline at end of file
......@@ -249,16 +249,6 @@ Page({
showPwdPop: false
})
},
processLogin(e) {
if (!e.detail.userInfo) {
wx.showToast({
title: '已取消',
icon: 'none',
})
return;
}
AUTH.register(this);
},
async exchangeCoupons() {
if (!this.data.number) {
wx.showToast({
......
......@@ -66,8 +66,7 @@
bind:change="onChange"
/>
<view class="block-btn">
<van-button wx:if="{{ isLogined }}" block type="primary" loading="{{ exchangeCouponsLoading }}" bind:click="exchangeCoupons">立即兑换</van-button>
<van-button wx:else block type="primary" open-type="getUserInfo" lang="zh_CN" bind:getuserinfo="processLogin">登陆后兑换</van-button>
<van-button block type="primary" loading="{{ exchangeCouponsLoading }}" bind:click="exchangeCoupons">立即兑换</van-button>
</view>
</view>
<view class="bottom"></view>
......
......@@ -161,16 +161,6 @@ Page({
url: '/pages/my/index'
})
},
processLogin(e) {
if (!e.detail.userInfo) {
wx.showToast({
title: '已取消',
icon: 'none',
})
return;
}
AUTH.register(this);
},
async setting() {
const res = await WXAPI.fxSetting()
if (res.code == 0) {
......
此差异已折叠。
{
"navigationBarTitleText": "商品详情"
}
\ No newline at end of file
<view class="container">
<van-sticky wx:if="{{createTabs}}">
<view id="tabs" class="tabs-container">
<van-tabs sticky bind:click="onTabsChange" custom-class="" active="{{ active }}">
<van-tab wx:for="{{tabs}}" title="{{item.tabs_name}}" name="{{item.tabs_name}}" />
</van-tabs>
</view>
</van-sticky>
<scroll-view class="scroll-container" scroll-into-view="{{toView}}" scroll-y="true" scroll-with-animation="true"
bindscroll="bindscroll">
<view wx:if="{{ imageDomain }}" class="swiper-container" id="swiper-container">
<swiper class="swiper_box" indicator-dots="true" indicator-active-color="#fff" autoplay circular>
<swiper-item wx:for="{{skuImages}}" wx:key="id">
<image src="{{imageDomain}}{{item.path}}" class="slide-image" mode="aspectFill" lazy-load="true" />
</swiper-item>
</swiper>
</view>
<view class="goods-info vcell">
<view class="goods-info-top-container">
<view class="goods-profile">
<view class="p"><text>¥</text> {{price.priceSale}}</view>
<view wx:if="{{price.priceJd && price.priceJd > 0}}" class="goods-price"
style='color:#aaa;text-decoration:line-through;padding: 15rpx 0rpx 0rpx 15rpx;'><text>¥</text>
{{price.priceJd}}</view>
</view>
<view class="goods-info-fx">
<view class='item left'>
<van-icon name="share-o" size="24px" />
<view class="icon-title">分享</view>
<button open-type='share'></button>
</view>
<view class='item' bindtap="drawSharePic">
<van-icon name="qr" size="24px" />
<view class="icon-title">二维码</view>
</view>
</view>
</view>
<view class="goods-title">{{price.skuName}}</view>
<view class="characteristic">{{goodsDetail.basicInfo.characteristic}}</view>
</view>
<van-cell wx:if="{{ shareQuanziProduct && show_wx_quanzi == '1' }}" custom-class="vw100" center title="微信圈子 好物圈">
<share-button type="1" fore-color="#e64340" product="{{ shareQuanziProduct }}"
bind:error="on_share_quanzi_error" />
</van-cell>
<view class="page__bd" wx:if="{{curGoodsKanjia}}" style='width:750rpx;'>
<view class="weui-cells__title">商品砍价设置</view>
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell">
<view class="weui-cell__bd">限量</view>
<view class="weui-cell__ft">{{curGoodsKanjia.number}}份</view>
</view>
<view class="weui-cell">
<view class="weui-cell__bd">已售</view>
<view class="weui-cell__ft">{{curGoodsKanjia.numberBuy}}份</view>
</view>
<view class="weui-cell">
<view class="weui-cell__bd">原价</view>
<view class="weui-cell__ft">¥{{curGoodsKanjia.originalPrice}}</view>
</view>
<view class="weui-cell">
<view class="weui-cell__bd">底价</view>
<view class="weui-cell__ft">¥{{curGoodsKanjia.minPrice}}</view>
</view>
<view class="weui-cell">
<view class="weui-cell__bd">截止</view>
<view class="weui-cell__ft">{{curGoodsKanjia.dateEnd}}</view>
</view>
</view>
</view>
<view class="page__bd" wx:if="{{pingtuanSet}}" style='width:750rpx;'>
<view class="weui-cells__title">商品拼团设置</view>
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell">
<view class="weui-cell__bd">已成团</view>
<view class="weui-cell__ft">{{pingtuanSet.numberSucccess}}</view>
</view>
<view class="weui-cell">
<view class="weui-cell__bd">成团人数</view>
<view class="weui-cell__ft">{{pingtuanSet.numberPersion}}</view>
</view>
<view class="weui-cell">
<view class="weui-cell__bd">退款条件</view>
<view class="weui-cell__ft">{{pingtuanSet.timeoutHours}}小时未成团</view>
</view>
<view class="weui-cell">
<view class="weui-cell__bd">截止</view>
<view class="weui-cell__ft">{{pingtuanSet.dateEnd}}</view>
</view>
</view>
</view>
<view class="curKanjiaprogress" wx:if="{{curKanjiaprogress}}">
<view class="name">帮
<text style='color:red;font-weight:bold;'>{{curKanjiaprogress.joiner.nick}}</text> 砍价吧!</view>
<view class="weui-badge">当前价格 ¥ {{curKanjiaprogress.kanjiaInfo .curPrice}}
</view>
<view class="weui-progress" style='background-color:#fff;'>
<view class="weui-progress__bar">
<progress
percent="{{100 * (curGoodsKanjia.originalPrice - curKanjiaprogress.kanjiaInfo.curPrice) / (curGoodsKanjia.originalPrice - curGoodsKanjia.minPrice)}}"
stroke-width="8" />
</view>
</view>
<view class="weui-flex">
<view>
<view class="placeholder">{{curGoodsKanjia.originalPrice}}</view>
</view>
<view class="weui-flex__item"></view>
<view>
<view class="placeholder">{{curGoodsKanjia.minPrice}}</view>
</view>
</view>
<view class="weui-flex">
<view>
<view class="placeholder">原价</view>
</view>
<view class="weui-flex__item"></view>
<view>
<view class="placeholder">底价</view>
</view>
</view>
<view class="weui-flex">
<view class="weui-flex__item kjbutton">
<button class="weui-btn" type="primary" open-type="share">邀请朋友帮忙</button>
</view>
<view class="weui-flex__item kjbutton">
<button class="weui-btn" type="warn" bindtap="helpKanjia"
disabled="{{myHelpDetail}}">{{myHelpDetail?"您已砍过":"帮TA砍"}}</button>
</view>
</view>
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell">
<view class="weui-cell__bd">帮砍人数</view>
<view class="weui-cell__ft">{{curKanjiaprogress.kanjiaInfo .helpNumber}}
</view>
</view>
<view class="weui-cell">
<view class="weui-cell__bd">状态</view>
<view class="weui-cell__ft">{{curKanjiaprogress.kanjiaInfo .statusStr}}
</view>
</view>
<view class="weui-cell">
<view class="weui-cell__bd">报名时间</view>
<view class="weui-cell__ft">¥{{curKanjiaprogress.kanjiaInfo .dateAdd}}
</view>
</view>
</view>
</view>
<button wx:if="{{curGoodsKanjia && (!curKanjiaprogress || curKanjiaprogress.kanjiaInfo.uid != curuid)}}"
class="weui-btn" type="warn" bindtap="joinKanjia" style='width:700rpx;'>我也要报名参与</button>
<view class='space'></view>
<view class="goods-des-info" style="margin-top:35rpx;" wx:if="{{pingtuanList}}">
<view class="label-title" style="border-bottom:1px solid #eee;">{{pingtuanList.length}}人在拼单,可直接参与</view>
<view class="goods-text" style="margin-top:15rpx;border-bottom:1px solid #eee;overflow:hidden;"
wx:for="{{pingtuanList}}" wx:key="id">
<view style="width:150rpx;float:left;">
<image style="width: 150rpx; height: 150rpx;" src="{{item.apiExtUser.avatarUrl}}"></image>
<view style="width:150rpx;text-align:center;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
{{item.apiExtUser.nick}}</view>
</view>
<view style="width:500rpx;float:left;margin-left:35rpx;">
<view>已有
<text style="color:red"> {{item.helpNumber}} </text>人参与</view>
<view style="color: #B0B0B0;font-size:24rpx;">截止: {{item.dateEnd}}</view>
<button type="warn" size="mini" data-pingtuanopenid="{{item.id}}" bindtap="toPingtuan"> 去拼单 </button>
</view>
</view>
</view>
<van-cell wx:if="{{hasMoreSelect && goodsDetailSkuShowType==0}}" custom-class="vw100" is-link
bind:click="bindGuiGeTap">
<view slot="title">
请选择:
<block wx:for="{{goodsDetail.properties}}" wx:key="id"> {{item.name}}</block>
<block wx:for="{{goodsAddition}}" wx:key="id"> {{item.name}}</block>
</view>
</van-cell>
<view class="size-label-box2" wx:if="{{goodsDetailSkuShowType==1}}">
<view class="label-title">选择商品规格</view>
<view class="size-label-box">
<block wx:for="{{goodsDetail.properties}}" wx:for-item="property" wx:for-index="idx" wx:key="id">
<view class="label">{{property.name}}</view>
<view class="label-item-box">
<view class="label-item {{item.active ? 'active' : '' }}" wx:for="{{property.childsCurGoods}}" wx:key="id"
bindtap="labelItemTap" data-propertyindex="{{idx}}" data-propertychildindex="{{index}}">
{{item.name}}
</view>
</view>
</block>
</view>
<van-cell title="购买数量">
<view>
<van-stepper value="{{ buyNumber }}" min="{{ buyNumMin }}" max="{{ buyNumMax }}" bind:change="stepChange" />
</view>
</van-cell>
</view>
<view wx:if="{{shopSubdetail}}" class="shop-container">
<image mode="aspectFill" src="{{shopSubdetail.info.pic}}"></image>
<view class="info">
<view class="title">{{shopSubdetail.info.name}}</view>
<view class="address">{{shopSubdetail.info.address}}</view>
</view>
</view>
<view class="goods-des-info" id="goods-des-info">
<view class="label-title">
<view class="left">商品详情</view>
</view>
<view class="goods-text">
<image wx:for="{{wxintroduction}}" wx:key="id" mode="widthFix" src="{{ item }}"></image>
</view>
</view>
<van-cell-group wx:if="{{!curGoodsKanjia && reputation}}" custom-class="vw100" title="宝贝评价">
<block wx:for="{{reputation}}" wx:key="id">
<van-cell custom-class="reputation-cell" icon="{{item.user.avatarUrl}}" title="{{item.user.nick}}"
label="{{item.goods.dateReputation}}" border="{{ false }}">
<van-rate value="{{ item.goods.goodReputation }}" color="#e64340" readonly />
</van-cell>
<van-cell wx:if="{{ item.goods.goodReputationRemark }}" title-class="reputation-cell-reamrk"
title="{{item.goods.goodReputationRemark}}" />
<view wx:if="{{ item.reputationPics }}" class="reputation-pics">
<image wx:for="{{item.reputationPics}}" wx:for-item="picItem" src="{{ picItem.pic }}" mode="aspectFill"
bindtap="previewImage" data-url="{{ picItem.pic }}"></image>
</view>
<van-cell wx:if="{{ item.goods.goodReputationReply }}" title-class="reputation-cell-reamrk"
title="掌柜回复:{{item.goods.goodReputationReply}}" />
</block>
</van-cell-group>
<view wx:if="{{curKanjiaprogress && curKanjiaprogress.helps && curKanjiaprogress.helps.length>0}}"
class="weui-panel weui-panel_access" style="width:750rpx;">
<view class="weui-panel__hd">砍价记录</view>
<view class="weui-panel__bd">
<view wx:for="{{curKanjiaprogress.helps}}" wx:key="*this" class="weui-media-box weui-media-box_appmsg">
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg">