Преглед изворни кода

适用门店新模式#3

soldDate
HolyKnightIX пре 2 година
родитељ
комит
a0aa2e7452
3 измењених фајлова са 177 додато и 287 уклоњено
  1. +2
    -107
      components/shop/shop.ttml
  2. +164
    -164
      index/index.js
  3. +11
    -16
      pages/couponorder/detail/index.js

+ 2
- 107
components/shop/shop.ttml Прегледај датотеку

@@ -15,7 +15,7 @@

<!-- 当商户数量不大于三个时 -->
<view class="goExpand" catchtap="expandList" data-index="{{index}}">
<view tt:if="{{item.merchantVoList.length<=3}}">
<view>
<view>{{item.merchantVoList.length+'家门店适用'}}</view>
<image tt:if="{{!item.expand}}" src="../../assets/itemImg/chevron.png" mode="widthFix"
class="rightArrowDown">
@@ -25,7 +25,7 @@
</view>

<!-- 当item.expand为true且商户数量不大于三个时 -->
<view class="shop" tt:if="{{item.expand&&item.merchantVoList.length<=3}}">
<view class="shop" tt:if="{{item.expand}}">
<view class='posi' tt:for="{{item.merchantVoList}}" tt:key="index">
<view class='posi_logo'>
<view bindtap='gotoDetail' data-id='{{item.id}}' data-tenantId='{{item.tenantId}}'>
@@ -57,110 +57,5 @@
</view>
</view>
</view>
<!-- 当商户数量不大于三个时 -->
<view class="shop" tt:if="{{item.merchantVoList.length>3}}">
<!-- 当item.expand为true时 -->
<view class='posi' tt:if="{{item.expand}}" tt:for="{{item.merchantVoList}}" tt:key="index">
<view class='posi_logo'>
<view bindtap='gotoDetail' data-id='{{item.id}}' data-tenantId='{{item.tenantId}}'>
<image src='{{item.merchantImgUrl}}'></image>
</view>
<view bindtap='gotoDetail' data-id='{{item.id}}' data-tenantId='{{item.tenantId}}'>
<view class='name'>{{item.merchantName}}</view>
<view class='shopVoList'>
<view tt:for="{{item.shopVoList}}" tt:key="{{index}}" tt:for-item="itemName">
<text>{{itemName.buildingName}}{{itemName.floorName}}--{{itemName.shopNumber}}</text>
<text class='douhao' tt:if="{{item.shopVoList.length>1}}">,</text>
</view>
</view>
</view>
<view class="telBox" tt:if="{{item.linkLinePhone}}">
<image bindtap='phone' data-merchantLinkPhone='{{item.linkLinePhone}}' class="telImg"
src="{{teljpgUrl}}" mode="widthFix" />
<view class="telText">电话</view>
</view>
<view class="certificationBox" tt:if="{{item.latitude&&item.longitude}}" bindtap="goCertification"
data-id="{{item.id}}">
<image class="certificationImg" src="../../assets/imgData/certification.png" mode="widthFix" />
<view class="telText">资质</view>
</view>
</view>
<view class="siteBox" tt:if="{{item.latitude&&item.longitude}}" bindtap="goMap" data-item="{{item}}">
<view class="siteText">{{item.addr}}</view>
<image class="siteImg" src="../../assets/imgData/siteImg.png" mode="widthFix" />
</view>
</view>
<!-- 当item.expand为true时 -->
<view class='posi' tt:if="{{item.expand}}" tt:for="{{item.merchantVoList}}" tt:key="index">
<view class='posi_logo'>
<view bindtap='gotoDetail' data-id='{{item.id}}' data-tenantId='{{item.tenantId}}'>
<image src='{{item.merchantImgUrl}}'></image>
</view>
<view bindtap='gotoDetail' data-id='{{item.id}}' data-tenantId='{{item.tenantId}}'>
<view class='name'>{{item.merchantName}}</view>
<view class='shopVoList'>
<view tt:for="{{item.shopVoList}}" tt:key="{{index}}" tt:for-item="itemName">
<text>{{itemName.buildingName}}{{itemName.floorName}}--{{itemName.shopNumber}}</text>
<text class='douhao' tt:if="{{item.shopVoList.length>1}}">,</text>
</view>
</view>
</view>
<view class="telBox" tt:if="{{item.linkLinePhone}}">
<image bindtap='phone' data-merchantLinkPhone='{{item.linkLinePhone}}' class="telImg"
src="{{teljpgUrl}}" mode="widthFix" />
<view class="telText">电话</view>
</view>
<view class="certificationBox" tt:if="{{item.latitude&&item.longitude}}" bindtap="goCertification"
data-id="{{item.id}}">
<image class="certificationImg" src="../../assets/imgData/certification.png" mode="widthFix" />
<view class="telText">资质</view>
</view>
</view>
<view class="siteBox" tt:if="{{item.latitude&&item.longitude}}" bindtap="goMap" data-item="{{item}}">
<view class="siteText">{{item.addr}}</view>
<image class="siteImg" src="../../assets/imgData/siteImg.png" mode="widthFix" />
</view>
</view>
<!-- 当item.expand为false时 -->
<view class='posi' tt:else tt:for="{{item.merchantVoList}}" tt:key="index">
<view class='posi_logo'>
<view bindtap='gotoDetail' data-id='{{item.id}}' data-tenantId='{{item.tenantId}}'>
<image src='{{item.merchantImgUrl}}'></image>
</view>
<view bindtap='gotoDetail' data-id='{{item.id}}' data-tenantId='{{item.tenantId}}'>
<view class='name'>{{item.merchantName}}</view>
<view class='shopVoList'>
<view tt:for="{{item.shopVoList}}" tt:key="{{index}}" tt:for-item="itemName">
<text>{{itemName.buildingName}}{{itemName.floorName}}--{{itemName.shopNumber}}</text>
<text class='douhao' tt:if="{{item.shopVoList.length>1}}">,</text>
</view>
</view>
</view>
<view class="telBox" tt:if="{{item.linkLinePhone}}">
<image bindtap='phone' data-merchantLinkPhone='{{item.linkLinePhone}}' class="telImg"
src="{{teljpgUrl}}" mode="widthFix" />
<view class="telText">电话</view>
</view>
<view class="certificationBox" tt:if="{{item.latitude&&item.longitude}}" bindtap="goCertification"
data-id="{{item.id}}">
<image class="certificationImg" src="../../assets/imgData/certification.png" mode="widthFix" />
<view class="telText">资质</view>
</view>
</view>
<view class="siteBox" tt:if="{{item.latitude&&item.longitude}}" bindtap="goMap" data-item="{{item}}">
<view class="siteText">{{item.addr}}</view>
<image class="siteImg" src="../../assets/imgData/siteImg.png" mode="widthFix" />
</view>
</view>
</view>

<!-- 当商户数量不小于三个时 -->
<view tt:if="{{item.merchantVoList.length>3}}">
<view>{{item.merchantVoList.length+'家门店适用,展开全部'}}</view>
<image tt:if="{{!item.expand}}" src="../../assets/itemImg/chevron.png" mode="widthFix"
class="rightArrowDown">
</image>
<image tt:else src="../../assets/itemImg/chevron.png" mode="widthFix" class="rightArrowUp"></image>
</view>
</view>
</view>

+ 164
- 164
index/index.js Прегледај датотеку

@@ -31,7 +31,7 @@ Page({
marketName: "", //商场名称
mouldType: null,
navLineHeight: ((app.statusBarHeight + app.statusBarHeight) + 50) + "px",
navImgHeight:(((app.statusBarHeight + app.statusBarHeight) + 34)/2) + "px",
navImgHeight: (((app.statusBarHeight + app.statusBarHeight) + 34) / 2) + "px",
huanlechengImgurl: "https://formall.oss-accelerate.aliyuncs.com/cimg/v20211214/",
// mch_id: mch_id,
goUrl: "", //商圈跳转链接
@@ -116,15 +116,15 @@ Page({
moduleList: [], //按钮列表
},

getCongig(){//获取小程序是否开通授权手机号
getCongig() { //获取小程序是否开通授权手机号
Http.get({
url:config.api.getConfig,
data:{
key:"douyinPhoneStatus"
url: config.api.getConfig,
data: {
key: "douyinPhoneStatus"
}
}).then(res=>{
app.globalData.ifCongPh = res.data?res.data:1
}).catch(err=>{
}).then(res => {
app.globalData.ifCongPh = res.data ? res.data : 1
}).catch(err => {
app.globalData.ifCongPh = 1
})
},
@@ -187,8 +187,8 @@ Page({
url: config.api.couponChannelList,
data: param
}).then(res => {
if (res.data.list&&res.data.list.length != 0) {
if (res.data.list && res.data.list.length != 0) {
let tempLsit = this.data.businessData
let data = res.data.list
data.map(item => {
@@ -209,7 +209,7 @@ Page({
businessData: data
})
}
}else{
} else {
this.setData({
noDataFlag: true
})
@@ -257,7 +257,7 @@ Page({
//获取按钮列表
getModule() {
Http.get({
url: config.api.wxCustomizeModule
url: config.api.wxCustomizeModule
}).then(res => {
this.setData({
moduleList: res.data,
@@ -518,7 +518,7 @@ Page({
* 生命周期函数--监听页面初次渲染完成
*/
onLoad: function (options) {
let that = this;
let optionss;

@@ -603,10 +603,10 @@ Page({
// this.uesrInfo()
this.ifShowSqare();
if (tt.getStorageSync("squareList") && tt.getStorageSync("selectedMall")) {
var temp = tt.getStorageSync("squareList").filter(item => item.tenantId == tt.getStorageSync("selectedMall"))[0].name
this.setData({
squareName: temp
})
// var temp = tt.getStorageSync("squareList").filter(item => item.tenantId == tt.getStorageSync("selectedMall"))[0].name
// this.setData({
// squareName: temp
// })
}
if (typeof this.getTabBar === 'function' &&
this.getTabBar()) {
@@ -656,25 +656,25 @@ Page({
getmemberId: function (token) {
let that = this;
Http.get({
url: config.api.getScore,
data: {
token: token
}
}).then(res => {
if(res.data.avatarUrl||res.data.nickName){
app.globalData.avatarUrl = res.data.avatarUrl
app.globalData.nickName = res.data.nickName
}
that.setData({
levelName: res.data.levelName,
upgradePercent: res.data.upgradePercent,
upgradeScore: res.data.upgradeScore,
memberId: res.data.id,
credit: res.data.credit,
userAvatarUrl: res.data.avatarUrl ? res.data.avatarUrl:'',
userName: res.data.nickName ? res.data.nickName:'',
url: config.api.getScore,
data: {
token: token
}
}).then(res => {
if (res.data.avatarUrl || res.data.nickName) {
app.globalData.avatarUrl = res.data.avatarUrl
app.globalData.nickName = res.data.nickName
}
that.setData({
levelName: res.data.levelName,
upgradePercent: res.data.upgradePercent,
upgradeScore: res.data.upgradeScore,
memberId: res.data.id,
credit: res.data.credit,
userAvatarUrl: res.data.avatarUrl ? res.data.avatarUrl : '',
userName: res.data.nickName ? res.data.nickName : '',
})
})
})
.catch(err => {
tt.showModal({
title: '提示',
@@ -738,7 +738,7 @@ Page({
if (app.globalData.token) {
// 登录
console.log(app.globalData.token)
that.getCongig()//获取小程序是否开通授权手机号
that.getCongig() //获取小程序是否开通授权手机号
that.setData({
mouldType: app.globalData.mouldType,
marketName: app.globalData.marketName,
@@ -780,11 +780,11 @@ Page({
app.businessListCallback(app.globalData.token);
}
Http.get({
url: config.api.getWeapNote,
data: {
appId: app.globalData.appId,
}
})
url: config.api.getWeapNote,
data: {
appId: app.globalData.appId,
}
})
.then(res => {
console.log(33333333333)
console.log(app.globalData.token)
@@ -814,7 +814,7 @@ Page({
app.tokenCallback = token => {
// 登录
console.log(app.globalData.token)
that.getCongig()//获取小程序是否开通授权手机号
that.getCongig() //获取小程序是否开通授权手机号
that.setData({
mouldType: app.globalData.mouldType,
marketName: app.globalData.marketName,
@@ -852,11 +852,11 @@ Page({
}

Http.get({
url: config.api.getWeapNote,
data: {
appId: app.globalData.appId,
}
})
url: config.api.getWeapNote,
data: {
appId: app.globalData.appId,
}
})
.then(res => {
console.log(33333333333)
console.log(app.globalData.token)
@@ -889,26 +889,26 @@ Page({
getStaticGame(token) {
let _this = this;
Http.get({
url: config.api.getGame,
data: {
triggleAction: 2, // 固定入口
token: token
}
}).then(res => {
if (res.data.id) {
_this.setData({
showIf: true,
newUrl: res.data.imgUrl
})
} else {
url: config.api.getGame,
data: {
triggleAction: 2, // 固定入口
token: token
}
}).then(res => {
if (res.data.id) {
_this.setData({
showIf: true,
newUrl: res.data.imgUrl
})
} else {
_this.setData({
showIf: false
})
}
_this.setData({
showIf: false
staticGamedata: res.data
})
}
_this.setData({
staticGamedata: res.data
})
})
.catch(err => {
_this.setData({
showIf: false
@@ -919,25 +919,25 @@ Page({
getGameOne: function (token) {
let _this = this;
Http.get({
url: config.api.getGame,
data: {
triggleAction: 1, // 登录触发
token: token
}
}).then(res => {
if (res.data.id) {
_this.setData({
showGame: true,
})
} else {
url: config.api.getGame,
data: {
triggleAction: 1, // 登录触发
token: token
}
}).then(res => {
if (res.data.id) {
_this.setData({
showGame: true,
})
} else {
_this.setData({
showGame: false
})
}
_this.setData({
showGame: false
gamedata: res.data
})
}
_this.setData({
gamedata: res.data
})
})
.catch(err => {
_this.setData({
showGame: false
@@ -951,18 +951,18 @@ Page({
getMallInfo: function (token) {
let that = this;
Http.get({
url: config.api.getMallInfo,
data: {
token: token,
}
}).then(res => {
that.setData({
liveFlag: res.data.liveSupport,
weappShareTitle: res.data.weappShareTitle ? res.data.weappShareTitle : null,
weappShareCoverImg: res.data.weappShareCoverImg ? res.data.weappShareCoverImg : null,
});
console.log(that.data.liveFlag, "||||")
})
url: config.api.getMallInfo,
data: {
token: token,
}
}).then(res => {
that.setData({
liveFlag: res.data.liveSupport,
weappShareTitle: res.data.weappShareTitle ? res.data.weappShareTitle : null,
weappShareCoverImg: res.data.weappShareCoverImg ? res.data.weappShareCoverImg : null,
});
console.log(that.data.liveFlag, "||||")
})
.catch(err => {
// 不需要错误提示
});
@@ -971,24 +971,24 @@ Page({
getxsList() {
let that = this;
Http.get({
url: config.api.couponChannelList,
data: {
pageNum: 1,
pageSize: 3,
targetAd: 2
}
}).then(res => {
if (res && res.data.total > 0) {
that.setData({
xslist: res.data.list,
showQg: true
});
} else {
that.setData({
showQg: false
})
}
})
url: config.api.couponChannelList,
data: {
pageNum: 1,
pageSize: 3,
targetAd: 2
}
}).then(res => {
if (res && res.data.total > 0) {
that.setData({
xslist: res.data.list,
showQg: true
});
} else {
that.setData({
showQg: false
})
}
})
.catch(err => {
console.log(err)
tt.showToast({
@@ -1005,19 +1005,19 @@ Page({
getBannerlist: function () {
let that = this;
Http.get({
url: config.api.bannerlist,
data: {
pageNum: 1,
pageSize: 7,
plat:3
}
}).then(res => {
that.getmemberId(app.globalData.token);
// that.checkUserCarStatus();
that.setData({
list: res.data.list
});
})
url: config.api.bannerlist,
data: {
pageNum: 1,
pageSize: 7,
plat: 3
}
}).then(res => {
that.getmemberId(app.globalData.token);
// that.checkUserCarStatus();
that.setData({
list: res.data.list
});
})
.catch(err => {
that.getmemberId(app.globalData.token);
// that.checkUserCarStatus();
@@ -1117,24 +1117,24 @@ Page({
topicShow: function () {
let that = this;
Http.get({
url: config.api.topicShow,
data: {
token: app.globalData.token
}
}).then(res => {
if (res && res.data) {
that.setData({
name: res.data.name,
cover: res.data.cover,
id: res.data.id,
showTopic: true
})
} else {
that.setData({
showTopic: false
})
}
})
url: config.api.topicShow,
data: {
token: app.globalData.token
}
}).then(res => {
if (res && res.data) {
that.setData({
name: res.data.name,
cover: res.data.cover,
id: res.data.id,
showTopic: true
})
} else {
that.setData({
showTopic: false
})
}
})
.catch(err => {
console.log(err);
})
@@ -1218,30 +1218,30 @@ Page({

let that = this
Http.get({
url: config.api.getGg,
data: {
token: token,
appId: app.globalData.appId,
openId: "" // tt.getStorageSync('openId')
}
}).then(res => {
console.log(res)
if (res.data.id) {
that.setData({
showGg: true,
})
console.log(that.data.showGg, 1111111111111)
} else {
url: config.api.getGg,
data: {
token: token,
appId: app.globalData.appId,
openId: "" // tt.getStorageSync('openId')
}
}).then(res => {
console.log(res)
if (res.data.id) {
that.setData({
showGg: true,
})
console.log(that.data.showGg, 1111111111111)
} else {
that.setData({
showGg: false
})
// that.getGameOne(app.globalData.token)
console.log(that.data.showGg, 222222222222222222)
}
that.setData({
showGg: false
ggdata: res.data
})
// that.getGameOne(app.globalData.token)
console.log(that.data.showGg, 222222222222222222)
}
that.setData({
ggdata: res.data
})
})
.catch(err => {
this.setData({
showGg: false
@@ -1264,7 +1264,7 @@ Page({
topicObj4: null, //欢乐城首页拼团
topicObj5: null, //欢乐城首页消费卡
topicObj6: null, //欢乐城首页积分商城
specialLsit: null,//专题
specialLsit: null, //专题
})
// that.getWeapNote();
that.setData({
@@ -1310,7 +1310,7 @@ Page({
page: that.data.page,
businePageNum: that.data.businePageNum + 1
});
console.log("加载更多页数" + that.data.page,);
console.log("加载更多页数" + that.data.page, );
console.log("加载更多key" + that.data.code);
if (that.data.mouldType == 0) { //富茂源模板
//父组件获得子组件的方法


+ 11
- 16
pages/couponorder/detail/index.js Прегледај датотеку

@@ -28,7 +28,8 @@ Page({
couponTenantId: '',
templTiem: "",
curHtml: "",
tenantId: ''
tenantId: '',
mallList: ''
},
showId() {
let this_ = this;
@@ -61,7 +62,8 @@ Page({

},

getCouponMerchant(couponChannelId) { //获取适用门店
//获取适用门店
getCouponMerchant(couponChannelId) {
Http.get({
url: config.api.couponMerchant,
data: {
@@ -83,20 +85,9 @@ Page({
this.setData({
mallList: mallList
})
// if (res.data && res.data.length) {
// let merchantVoList = res.data
// let idList = []
// merchantVoList.map(item => {
// idList.push(item.id)
// })
// this.setData({
// idList: idList
// })
// this.getCouponList(idList) //获取推荐列表
// }
// this.setData({
// merchantVoList: res.data
// })
console.log(this.mallList, 'mallList');
}).catch(err => {

})
},

@@ -117,6 +108,7 @@ Page({
}
})
},

onLoad: function (options) {
let that = this;
console.log(options);
@@ -143,11 +135,13 @@ Page({
tenantId: res.data.tenantId
})
that.setRq()
that.getCouponMerchant(res.data.id)
}
that.setData({
couponorderstatus: res.data.couponOrderStatus,
data: res.data,
});

that.setData({
expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dd hh:mm:ss"),
updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"),
@@ -170,6 +164,7 @@ Page({
}

}).catch(err => {
console.log(err, 'err');
tt.showToast({
title: err.message ? err.message : err.data,
icon: 'none',


Loading…
Откажи
Сачувај