소스 검색

首页修改

soldDate
HolyKnightIX 2 년 전
부모
커밋
64dba290dd
23개의 변경된 파일220개의 추가작업 그리고 130개의 파일을 삭제
  1. +1
    -0
      app.js
  2. BIN
      assets/images/location(1).png
  3. BIN
      assets/images/location(2).png
  4. BIN
      assets/images/location(3).png
  5. BIN
      assets/images/location(4).png
  6. BIN
      assets/images/location.png
  7. BIN
      assets/itemImg/arrow-right-l.png
  8. BIN
      assets/itemImg/arrow-right-l2.png
  9. BIN
      assets/itemImg/arrow-right-l3.png
  10. +17
    -17
      components/banner/index.js
  11. +4
    -1
      components/coupons/index.js
  12. +9
    -7
      components/coupons/index.ttml
  13. +14
    -13
      components/optimization/optimization.js
  14. +38
    -35
      components/optimization/optimization.ttml
  15. +73
    -17
      index/index.js
  16. +3
    -1
      index/index.ttml
  17. +16
    -7
      index/index.ttss
  18. +16
    -13
      index/searchbar.js
  19. +5
    -4
      pages/bannerdetail/bannerdetail.js
  20. +2
    -1
      pages/coupon/detail/index.js
  21. +1
    -0
      pages/index/searchbar/detail/index.js
  22. +14
    -6
      pages/order/index/index.js
  23. +7
    -8
      utils/HttpBasics.js

+ 1
- 0
app.js 파일 보기

@@ -72,6 +72,7 @@ App({
}
})
},

login() {
let that = this;
tt.login({


BIN
assets/images/location(1).png 파일 보기

Before After
Width: 128  |  Height: 128  |  Size: 5.4 KiB

BIN
assets/images/location(2).png 파일 보기

Before After
Width: 128  |  Height: 128  |  Size: 7.6 KiB

BIN
assets/images/location(3).png 파일 보기

Before After
Width: 128  |  Height: 128  |  Size: 3.7 KiB

BIN
assets/images/location(4).png 파일 보기

Before After
Width: 128  |  Height: 128  |  Size: 5.0 KiB

BIN
assets/images/location.png 파일 보기

Before After
Width: 128  |  Height: 128  |  Size: 5.7 KiB

BIN
assets/itemImg/arrow-right-l.png 파일 보기

Before After
Width: 128  |  Height: 128  |  Size: 1.1 KiB

BIN
assets/itemImg/arrow-right-l2.png 파일 보기

Before After
Width: 128  |  Height: 128  |  Size: 1.8 KiB

BIN
assets/itemImg/arrow-right-l3.png 파일 보기

Before After
Width: 128  |  Height: 128  |  Size: 1.6 KiB

+ 17
- 17
components/banner/index.js 파일 보기

@@ -19,44 +19,45 @@ Component({
data: {
bannerUrl: imgurl.banner.url,
currentIndex: 0,
mouldType:0,
mouldType: 0,
},

/**
* 组件的方法列表
*/
methods: {
gotobannerdetail: function(e) {
gotobannerdetail: function (e) {
console.log(e, 'e');

console.log(this.data.list)
if (e.currentTarget.dataset.data.type == 3) {
// 小程序路径
let indexOf = (e.currentTarget.dataset.data.pagePath).indexOf("=");
console.log(indexOf, "123")
let id = (e.currentTarget.dataset.data.pagePath).substr(indexOf);
console.log(id.split("="),123);
let type = (e.currentTarget.dataset.data.pagePath).substr(indexOf + 1, 2)// 2020/7/22 变量获取pagePath中的type
console.log(id.split("="), 123);
let type = (e.currentTarget.dataset.data.pagePath).substr(indexOf + 1, 2) // 2020/7/22 变量获取pagePath中的type
console.log(indexOf, id, type);
console.log(e.currentTarget.dataset.data.pagePath)
if(type == 'cd' || type == 'sd'){
if (type == 'cd' || type == 'sd') {
tt.navigateTo({
url: `/${e.currentTarget.dataset.data.pagePath}`,
})
}else if(type == "wj"){
} else if (type == "wj") {
tt.navigateTo({
url: `/pages/questionnaire/questionnaire?id=`+id.split("=")[2],
url: `/pages/questionnaire/questionnaire?id=` + id.split("=")[2],
})
}else if (type == 'ra'){
} else if (type == 'ra') {
tt.navigateTo({
url: `/pages/radetail/index?id=`+id.split("=")[2],
url: `/pages/radetail/index?id=` + id.split("=")[2],
})
}
}else if(e.currentTarget.dataset.data.type==2){
} else if (e.currentTarget.dataset.data.type == 2) {
// 自由图文
tt.navigateTo({
url: `/pages/freeBannerDetail/index?id=${e.currentTarget.dataset.id}`
});
}else if(e.currentTarget.dataset.data.type==4){
} else if (e.currentTarget.dataset.data.type == 4) {
tt.navigateToMiniProgram({
appId: e.currentTarget.dataset.data.goAppid,
// path: 'page/index/index?id=123',
@@ -68,11 +69,10 @@ Component({
// 打开成功
}
})
}
else{
} else {
// 固定格式
tt.navigateTo({
url: `/pages/bannerdetail/bannerdetail?id=${e.currentTarget.dataset.id}`
url: `/pages/bannerdetail/bannerdetail?id=${e.currentTarget.dataset.id}&mallTenantId=${e.currentTarget.dataset.data.tenantId}`
});
}
},
@@ -84,10 +84,10 @@ Component({
},
attached: function () {
// 在组件实例进入页面节点树时执行
if (app.globalData.mouldType){
if (app.globalData.mouldType) {
this.setData({
mouldType: app.globalData.mouldType
})
}
},
});
});

+ 4
- 1
components/coupons/index.js 파일 보기

@@ -28,13 +28,16 @@ Component({
},
methods: {
gotoDetail(e) {

console.log(e, 'e');
let couponId = e.currentTarget.dataset.couponid;
let title = e.currentTarget.dataset.title;
let id = e.currentTarget.dataset.id;
let targetAd = e.currentTarget.dataset.targetad;
let mallTenantId = e.currentTarget.dataset.malltenantid;
if (id && targetAd != 7) {
tt.navigateTo({
url: `/pages/coupon/detail/index?couponChannelId=${id}&couponId=${couponId}&title=${title}`,
url: `/pages/coupon/detail/index?couponChannelId=${id}&couponId=${couponId}&title=${title}&mallTenantId=${mallTenantId}`,
})
} else if (targetAd == 7) {
tt.navigateTo({


+ 9
- 7
components/coupons/index.ttml 파일 보기

@@ -1,5 +1,5 @@
<view class='navigator' bindtap='gotoDetail' data-id='{{data.id}}' data-targetAd='{{data.targetAd}}' hover-class='hover'
data-couponId='{{data.couponId}}' data-title='{{data.title}}'>
data-couponId='{{data.couponId}}' data-title='{{data.title}}' data-malltenantid='{{data.tenantId}}'>
<view class="presell" tt:if="{{data.type==10}}" style="{{mouldType==1?'top: 280rpx;':''}}">预售 </view>
<!-- 首页优惠券列表页面 -->
<view class="coupons">
@@ -23,8 +23,8 @@
<view class="coupons-info-name tit">{{data.title}}</view>
<view class="coupons-info-name subtitle">{{data.subTitle}}</view>
<view class="coupons-info-price-p">
<view class='price' tt:if="{{data.type!=10&&mouldType==1}}">
<view class="fuhaoX"> ¥{{data.salePriceStr}}</view>
<view class='price' tt:if="{{data.type!=10&&mouldType==1}}">
<view class="fuhaoX"> ¥{{data.salePriceStr}}</view>
</view>
<view class='price' tt:if="{{data.type!=10&&mouldType!=1}}">
<text tt:if="{{data.targetAd == 101||data.targetAd == 5}}"><text class='rmb'>¥</text>
@@ -61,8 +61,9 @@

<view class="coupons-btn" tt:if="{{mouldType!=1}}">
<!-- 优惠券价格 -->
<i-button i-class=" coupons-btn-gm" tt:if="{{data.salePriceStr==0&&data.remainInventory!=0&&data.targetAd == 101}}"
data-date='{{data}}'>免费领</i-button>
<i-button i-class=" coupons-btn-gm"
tt:if="{{data.salePriceStr==0&&data.remainInventory!=0&&data.targetAd == 101}}" data-date='{{data}}'>免费领
</i-button>
<i-button i-class="coupons-btn-gm"
tt:if="{{data.salePriceStr!=0&&data.remainInventory!=0&&data.targetAd == 101||data.salePriceStr!=0&&data.remainInventory!=0&&data.targetAd == 5}}"
data-date='{{data}}'>购买</i-button>
@@ -79,8 +80,9 @@

<view class="coupons-btn" tt:if="{{mouldType==1}}">
<!-- 优惠券价格 -->
<i-button i-class=" coupons-btn-gmX" tt:if="{{data.salePriceStr==0&&data.remainInventory!=0&&data.targetAd == 101}}"
data-date='{{data}}'>免费领</i-button>
<i-button i-class=" coupons-btn-gmX"
tt:if="{{data.salePriceStr==0&&data.remainInventory!=0&&data.targetAd == 101}}" data-date='{{data}}'>免费领
</i-button>
<i-button i-class="coupons-btn-gmX"
tt:if="{{data.salePriceStr!=0&&data.remainInventory!=0&&data.targetAd == 101||data.salePriceStr!=0&&data.remainInventory!=0&&data.targetAd == 5}}"
data-date='{{data}}'>购买</i-button>


+ 14
- 13
components/optimization/optimization.js 파일 보기

@@ -4,9 +4,9 @@ Component({
* 组件的属性列表
*/
properties: {
businessList:{
type:Array,
value:[]
businessList: {
type: Array,
value: []
},
businessData: {
type: Array,
@@ -18,39 +18,40 @@ Component({
* 组件的初始数据
*/
data: {
classIndex:0
classIndex: 0
},

/**
* 组件的方法列表
*/
methods: {
goDetail(e){
goDetail(e) {
let couponChannelId = e.currentTarget.dataset.id
let couponId = e.currentTarget.dataset.couponid
let mallTenantId = e.currentTarget.dataset.malltenantid
tt.navigateTo({
url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}`,
url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}&mallTenantId=${mallTenantId}`,
})
},
setIndex(e){
setIndex(e) {
let index = e.currentTarget.dataset.index
let id = e.currentTarget.dataset.id
this.triggerEvent('businessid',id)
this.triggerEvent('businessid', id)
this.setData({
classIndex:index
classIndex: index
})
},
goLsit(){
goLsit() {
tt.navigateTo({
url: '/pages/liveLsit/liveLsit',
success: (res) => {
},
fail: (res) => {
},
});
}

}
})
})

+ 38
- 35
components/optimization/optimization.ttml 파일 보기

@@ -1,31 +1,33 @@
<view class="optimizationBox">
<view class="titleImg">
<view class="textl f">优选好物</view>
<view class="textr r">Preferred Good</view>
</view>
<view class="classifyBox-go-box">
<view class="classifyBox">
<view class="itemBox" tt:for="{{businessList}}" tt:key="{{index}}" bindtap="setIndex" data-index="{{index}}" data-id="{{item.id}}">
<view class="{{classIndex==index?'className_a':'className'}}">{{item.title}}</view>
<view class="xian" tt:if="{{classIndex==index}}"></view>
</view>
<view class="titleImg">
<view class="textl f">优选好物</view>
<view class="textr r">Preferred Good</view>
</view>
<view class="classifyBox-go-box">
<view class="classifyBox">
<view class="itemBox" tt:for="{{businessList}}" tt:key="{{index}}" bindtap="setIndex" data-index="{{index}}"
data-id="{{item.id}}">
<view class="{{classIndex==index?'className_a':'className'}}">{{item.title}}</view>
<view class="xian" tt:if="{{classIndex==index}}"></view>
</view>
<!-- <view class="goLsit" bindtap="goLsit"> 直播商品 <image class="rup" src="https://formall.oss-accelerate.aliyuncs.com/cimg/v20211214/home_icon_jt.png"></image></view> -->
</view>
<view class="contBox">
<view class="contLsitBox">
<view class="item" tt:for="{{businessData}}" tt:key="{{index}}" bindtap="goDetail" data-couponid="{{item.couponId}}" data-id="{{item.id}}">
<view class="itemImg">
<image src="{{item.coverImg}}" mode='scaleToFill'></image>
</view>
<view class="titleName">{{item.title}}</view>
<!-- <view class="goLsit" bindtap="goLsit"> 直播商品 <image class="rup" src="https://formall.oss-accelerate.aliyuncs.com/cimg/v20211214/home_icon_jt.png"></image></view> -->
</view>

<!-- <view class="priceBox">
<view class="contBox">
<view class="contLsitBox">
<view class="item" tt:for="{{businessData}}" tt:key="{{index}}" bindtap="goDetail"
data-couponid="{{item.couponId}}" data-id="{{item.id}}" data-malltenantid="{{item.tenantId}}">
<view class="itemImg">
<image src="{{item.coverImg}}" mode='scaleToFill'></image>
</view>
<view class="titleName">{{item.title}}</view>

<!-- <view class="priceBox">
<view class="sellingBox f">
<view class="fuhao">¥</view>
<view class="int">{{item.salePriceStrQ?item.salePriceStrQ:item.salePriceStr}}</view>
@@ -37,19 +39,20 @@
</view>
</view> -->

<view class="priceBox">
<view class="sellingBox f">
<view class="priceBox">
<view class="sellingBox f">

<view class="fuhaoX">¥{{item.salePriceStr?item.salePriceStr:""}} </view>

<view class="fuhaoX">¥{{item.salePriceStr?item.salePriceStr:""}} </view>
</view>
<view class="r btn">马上抢</view>
</view>
<view class="sellout" tt:if="{{item.remainInventory==0}}">
<image class="selloutImg" src="https://formall.oss-accelerate.aliyuncs.com/cimg/v20211214/home_img_ysx.png"></image>
</view>
<view class="r btn">马上抢</view>
</view>

<view class="sellout" tt:if="{{item.remainInventory==0}}">
<image class="selloutImg" src="https://formall.oss-accelerate.aliyuncs.com/cimg/v20211214/home_img_ysx.png">
</image>
</view>
</view>
</view>
</view>
</view>
</view>

+ 73
- 17
index/index.js 파일 보기

@@ -117,7 +117,8 @@ Page({
currentMall: '富茂广场',
shopList: [],
mallTenantId: tt.getStorageSync('mallTenantId') || '',
index: tt.getStorageSync('mallIndex') || 0
index: tt.getStorageSync('mallIndex') || 0,
locateData: {}
},

getCongig() { //获取小程序是否开通授权手机号
@@ -133,19 +134,25 @@ Page({
})
},

mallSync() {
this.setData({
mallTenantId: tt.getStorageSync('mallTenantId') || '',
index: tt.getStorageSync('mallIndex') || 0,
})
},

getsubMallList() {
Http.get({
url: '/mall/subMall?isAll=1',
}).then(res => {
this.setData({
shopList: res.data,
mallTenantId: res.data[0].tenantId
mallTenantId: tt.getStorageSync('mallTenantId') || res.data[0].tenantId
});
const index = this.data.index
const mallTenantId = this.data.shopList[index].tenantId
tt.setStorageSync('mallTenantId', mallTenantId)
tt.setStorageSync('mallIndex', index)
Http.setMallTenantId(mallTenantId);
if (!tt.getStorageSync('mallTenantId') && res.data.length > 1) {
tt.setStorageSync('mallTenantId', res.data[0].tenantId)
tt.setStorageSync('mallIndex', 0)
}
}).catch(err => {
console.log(err, 'err');
})
@@ -159,9 +166,11 @@ Page({
this.setData({
index: index,
mallTenantId: mallTenantId,
allow_load: true
});
Http.setMallTenantId(mallTenantId);
this.getBannerlist();
this.getBusinessList()
this.getCouponChannelList(0)
},

getBusineData(e) {
@@ -176,7 +185,8 @@ Page({
Http.get({
url: config.api.businessList,
data: {
filter: 2
filter: 2,
mallTenantId: this.data.mallTenantId,
}
}).then(res => {
this.setData({
@@ -206,14 +216,16 @@ Page({
param = {
pageNum: this.data.businePageNum,
pageSize: 6,
targetAd: 101
targetAd: 101,
mallTenantId: this.data.mallTenantId,
}
} else {
param = {
pageNum: this.data.businePageNum,
pageSize: 6,
business: key,
targetAd: 101
targetAd: 101,
mallTenantId: this.data.mallTenantId,

}
}
@@ -579,9 +591,6 @@ Page({
// util.barcode("barcode", optionss.quancode, 510, 100);
// console.log(Http.headers.token, "?")
this.getLocation()
setTimeout(() => {
this.getsubMallList()
}, 1000)
},
/**
* 获得经纬度
@@ -593,6 +602,13 @@ Page({
// isHighAccuracy: true,
success: function (res) {
console.log(res, 'getLocation')
const locateData = {
latitude: res.latitude,
longitude: res.longitude,
}
that.setData({
locateData: locateData
})
if (res && res.longitude && res.latitude) {
Http.post({
url: config.api.updateLBS,
@@ -616,9 +632,45 @@ Page({

},

/**
* @description:根据经纬度计算距离
* @param {*} locationInfo (lat1, lng1, lat2, lng2)
* @return: distanceObj: { distance , distance_str }
*/
getDistances(lat1, lng1, lat2, lng2) {

function rad(d) {
return d * Math.PI / 180.0;
}
var radLat1 = rad(lat1);
var radLat2 = rad(lat2);
var a = radLat1 - radLat2;
var b = rad(lng1) - rad(lng2);
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
s = s * 6378.137;
s = Math.round(s * 10000) / 10000;

var distance = s;
var distance_str = "";

if (parseInt(distance) >= 1) {
distance_str = distance.toFixed(2) + "km";
} else {
distance_str = (distance * 1000).toFixed(2) + "m";
}

let objData = {
distance: distance,
distance_str: distance_str
}
return objData
},



onShow: function () {
this.mallSync()
console.log(app.globalData.mouldType, "mouldType")
// tt.requestSubscribeMessage({
// tmplIds: [], // 需要填入开放平台申请的模版id,支持最多3个同类型模版
@@ -781,6 +833,7 @@ Page({
var that = this;

if (app.globalData.token) {
that.getsubMallList()
// 登录
console.log(app.globalData.token)
that.getCongig() //获取小程序是否开通授权手机号
@@ -808,7 +861,7 @@ Page({
that.topicShowall(6);
that.getBusinessList();
that.getCouponChannelList(0)
that.getsubMallList()

that.getType()
that.uesrInfo()
@@ -857,6 +910,7 @@ Page({

} else {
app.tokenCallback = token => {
that.getsubMallList()
// 登录
console.log(app.globalData.token)
that.getCongig() //获取小程序是否开通授权手机号
@@ -881,6 +935,7 @@ Page({
that.topicShowall(5);
that.topicShowall(6);
that.getBusinessList();

that.getCouponChannelList(0)
that.getType()
that.uesrInfo()
@@ -1054,7 +1109,8 @@ Page({
data: {
pageNum: 1,
pageSize: 7,
plat: 3
plat: 3,
mallTenantId: tt.getStorageSync('mallTenantId') || ""
}
}).then(res => {
that.getmemberId(app.globalData.token);


+ 3
- 1
index/index.ttml 파일 보기

@@ -22,7 +22,9 @@
disabled="{{false}}">
<view>
<view>
当前广场:{{ shopList[index].name }} ↓
<image src="../assets/images/location.png" class="location"></image>
<text class="mallName">{{ shopList[index].name }}</text>
<image src="../assets/itemImg/arrow-right-l.png" class="right"></image>
</view>
</view>
</picker>


+ 16
- 7
index/index.ttss 파일 보기

@@ -118,16 +118,25 @@ page {

.pickerMall {
height: auto;
margin: 10rpx 0 15rpx 10rpx;
margin: 0 0 15rpx 20rpx;
font-size: 30rpx;
}

.location {
position: relative;
top: 8rpx;
width: 35rpx;
height: 35rpx;
margin-right: 10rpx;
}

.underlingImg {
width: 30rpx;
height: 60rpx;
font-size: 30prx;
float: left;
/* margin-top: 20rpx; */

.right {
position: relative;
top: 6rpx;
left: 10rpx;
width: 35rpx;
height: 35rpx;
}

.underlingName {


+ 16
- 13
index/searchbar.js 파일 보기

@@ -11,7 +11,7 @@ Page({
data: {
navigationBarHeight,
navLineHeight: ((app.statusBarHeight + app.statusBarHeight) + 50) + "px",
navImgHeight:(((app.statusBarHeight + app.statusBarHeight) + 34)/2) + "px",
navImgHeight: (((app.statusBarHeight + app.statusBarHeight) + 34) / 2) + "px",
lists: [],
merchantVoList: [],
indexId: 0,
@@ -23,11 +23,11 @@ Page({
teljpgUrl: imgurl.teljpg.url,
map: imgurl.map.url, //商场地图
mapUrl: '/pages/marketAtlas/marketAtlas', //跳转地图的路径
mouldType:0,
mouldType: 0,
},
getFemgMap() { //判断时候对接封了地图
Http.get({
url: config.api.ifFengMap
url: config.api.ifFengMap + `?mallTenantId=${tt.getStorageSync('mallTenantId')||""}`
}).then(res => {
if (res.data) { //
let initMpa = {
@@ -82,13 +82,13 @@ Page({
*/
gotoDetail(e) {
tt.navigateTo({
url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}`
url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}&mallTenantId=${tt.getStorageSync('mallTenantId') || ""}`
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad: function (options) {
this.setData({
mouldType: app.globalData.mouldType,
})
@@ -112,19 +112,20 @@ Page({
})
};
tt.getSystemInfo({
success: function(res) {
success: function (res) {
that.setData({
windowHeight: res.windowHeight
})
},
})
},
getBussiness: function() {
getBussiness: function () {
let that = this;
Http.get({
url: config.api.businessList,
data: {
filter: 1
filter: 1,
mallTenantId: tt.getStorageSync('mallTenantId') || ""
}
}).then(res => {
that.setData({
@@ -144,19 +145,21 @@ Page({
});
})
},
getList: function(page, businessId) {
getList: function (page, businessId) {
let that = this;
let data;
if (businessId == 0) {
data = {
pageNum: page,
pageSize: 8
pageSize: 8,
mallTenantId: tt.getStorageSync('mallTenantId') || ""
}
} else {
data = {
pageNum: page,
pageSize: 8,
businessId: businessId
businessId: businessId,
mallTenantId: tt.getStorageSync('mallTenantId') || ""
}
}
Http.get({
@@ -189,7 +192,7 @@ Page({
});
})
},
phone: function(e) {
phone: function (e) {
let that = this;
if (e.currentTarget.dataset.merchantlinkphone) {
tt.makePhoneCall({
@@ -200,7 +203,7 @@ Page({
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
onReachBottom: function () {
let that = this;
that.data.page++;
that.setData({


+ 5
- 4
pages/bannerdetail/bannerdetail.js 파일 보기

@@ -22,14 +22,15 @@ Page({
mouldType: app.globalData.mouldType,
})
let that = this;
if (options.id){
if (options.id) {
Http.get({
url: config.api.bannerDetail,
data: {
id: options.id
id: options.id,
mallTenantId: options.mallTenantId,
}
}).then(res => {
if(res.data.type==2){
if (res.data.type == 2) {
that.setData({
nodes: res.data.html
})
@@ -52,4 +53,4 @@ Page({
url: '/index/index',
})
},
});
});

+ 2
- 1
pages/coupon/detail/index.js 파일 보기

@@ -560,7 +560,8 @@ Page({
Http.get({
url: config.api.getSpuid,
data: {
id: id
id: id,
mallTenantId: this.data.mallTenantId || ''
}
}).then(res => {
if (res.data) {


+ 1
- 0
pages/index/searchbar/detail/index.js 파일 보기

@@ -200,6 +200,7 @@ Page({
url: config.api.listByMerchant,
data: data
}).then(res => {
console.log(res, 'res');
that.setData({
couponList: res.data.page.list,
})


+ 14
- 6
pages/order/index/index.js 파일 보기

@@ -41,8 +41,8 @@ Page({
canIUse: tt.canIUse("button.open-type.getPhoneNumber"), //判断小程序是否能用获取手机插件
ifshowtab: null,
shopList: [],
index: 0,
mallTenantId: ''
mallTenantId: tt.getStorageSync('mallTenantId') || '',
index: tt.getStorageSync('mallIndex') || 0
},

setPhone(paramData) { //子组件调用这个方法说明手机号已经授权成功
@@ -79,8 +79,8 @@ Page({
bindPickerChange(e) {
const index = e.detail.value
const mallTenantId = this.data.shopList[index].tenantId
// tt.setStorageSync('mallTenantId', mallTenantId)
// tt.setStorageSync('mallIndex', index)
tt.setStorageSync('mallTenantId', mallTenantId)
tt.setStorageSync('mallIndex', index)
this.setData({
index: index,
mallTenantId: mallTenantId,
@@ -95,14 +95,21 @@ Page({
url: '/index/index',
})
},

mallSync() {
this.setData({
mallTenantId: tt.getStorageSync('mallTenantId') || '',
index: tt.getStorageSync('mallIndex') || 0,
})
},

onLoad(e) {
Http.get({
url: '/mall/subMall?isAll=1',
}).then(res => {
this.setData({
shopList: res.data,
// tt.getStorageSync('mallTenantId') ||
mallTenantId: res.data[0].tenantId
mallTenantId: tt.getStorageSync('mallTenantId') || res.data[0].tenantId
});
console.log(this.data.shopList, 'list');

@@ -111,6 +118,7 @@ Page({
})
},
onShow() {
this.mallSync()
this.getList(this.data.boatFlag, 1);
Http.get({
url: config.api.checkUserStatus,


+ 7
- 8
utils/HttpBasics.js 파일 보기

@@ -21,7 +21,6 @@ class HttpBasics {
headers = {
"Content-Type": "application/json;charset=UTF-8",
token: "",
mallTenantId: ""
// token:"3ab2afa2-f704-4086-b6e5-ad0715c7e2a1:1027:tt-cuser"
};

@@ -33,13 +32,13 @@ class HttpBasics {
this.headers.token = token;
}

/**
* @description 设置mallTenantId
* @param {*} mallTenantId
*/
setMallTenantId(mallTenantId) {
this.headers.mallTenantId = mallTenantId;
}
// /**
// * @description 设置mallTenantId
// * @param {*} mallTenantId
// */
// setMallTenantId(mallTenantId) {
// this.headers.mallTenantId = mallTenantId;
// }

/**
* 获取数据


불러오는 중...
취소
저장