作者 梁鹏山

fix:更新同步

要显示太多修改。

为保证性能只显示 16 of 16+ 个文件。

... ... @@ -7,9 +7,10 @@
<view class="word">{{type == 3?item.name:type==2?item.product_name:item.product.name}}</view>
<view class="info">
<view class="jifen">
<view class="name">积分</view>
<text wx:if='{{item.product.price2!=null||item.price2!=null}}'>{{type == 3 || type == 2?item.price2:item.product.price2}}</text>
<text wx:else>{{type == 3 || type == 2?item.goods_price:item.product.price}}</text>
<!-- 2023-10-19 需求要将积分改为微信支付的金额 -->
<!-- <view class="name">积分</view> -->
<text wx:if='{{item.product.price2!=null||item.price2!=null}}'>¥{{type == 3 || type == 2?item.price2:item.product.price2}}</text>
<text wx:else>¥{{type == 3 || type == 2?item.goods_price:item.product.price}}</text>
<text style="margin-left: 10rpx;color:#ccc;font-size: 28rpx;" wx:if="{{type == 3 || type == 4}}">X{{item.num}}</text>
</view>
<view class="num_box" wx:if="{{type == 1}}">
... ...
App({
onLaunch: function () {
if (wx.getStorageSync('token')) {
this.getmessagelist()
}
this.getToken();
//自动更新版本
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
})
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
onLaunch: function () {
if (wx.getStorageSync('token')) {
this.getmessagelist()
}
})
})
updateManager.onUpdateFailed(function () {
// 新的版本下载失败
wx.showModal({
title: '更新提示',
content: '新版本下载失败',
showCancel: false
})
})
},
post: function (url, data, showLoad) {
wx.showNavigationBarLoading()
var promise = new Promise((resolve, reject) => {
//init
let that = this;
let postData = data, baseUrl;
// let baseUrl = 'https://binhai.w.broing.cn/api';
// let baseUrl ='http://binhaitest.w.brotop.cn/api'
// 现在用的
// let baseUrl = 'https://binhai.w.broing.cn/api'
// let baseUrl = 'http://binhaitest.w.brotop.cn/api'
// 滨海
var entrance_type = wx.getStorageSync("entrance_type");
console.log(entrance_type);
if (entrance_type == '1' || entrance_type == '0' || url == '/getopenid/get' || url.indexOf('/wb/wb')>-1) {
//劳保商城入口
console.log('11111111111111111')
baseUrl = 'https://binhai.w.broing.cn/api';
// baseUrl = 'http://binhai.shs.broing.cn/api'
} else if (entrance_type == '2') {
//工会商城入口
console.log('@@@@@@@@@@@@@@@@@@@@@@')
baseUrl = 'https://binhaigh.w.broing.cn/api';
// baseUrl = 'http://gonghui.shs.broing.cn/api'
} else if (entrance_type == '3') {
//办公入口
baseUrl = 'https://bgcb.w.broing.cn/api';
}
// 天远甄选
// if (entrance_type == '1' || url == '/getopenid/get' || url.indexOf('address') > -1) {
// //劳保商城入口
// baseUrl = 'https://binhai2.w.broing.cn/api';
// } else if (entrance_type == '2') {
// //工会商城入口
// baseUrl = 'https://binhaigh2.w.broing.cn/api';
// } else if (entrance_type == '3') {
// //工会商城入口
// baseUrl = 'https://bgcb2.w.broing.cn/api';
// }
console.log(baseUrl);
//网络请求
wx.request({
url: baseUrl + url,
data: postData,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'token': wx.getStorageSync('token') || ''
},
success: function (res) { //返回取得的数据
console.log('ssssssssssssssssssssssssssssssssssss', res)
if (res.data.code == '200') {
resolve(res.data)
} else if (res.data.code == '5000') {
wx.hideLoading();
reject(res.data)
wx.removeStorageSync('login');
this.getToken();
//自动更新版本
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
})
updateManager.onUpdateReady(function () {
wx.showModal({
title: '提示',
content: res.data.msg,
showCancel: false
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
wx.removeStorageSync('token');
setTimeout(() => {
wx.navigateTo({
url: '/pages/register/register?type=1',
})
}, 1200)
} else {
})
updateManager.onUpdateFailed(function () {
// 新的版本下载失败
wx.showModal({
title: '提示',
content: res.data.msg,
showCancel: false
title: '更新提示',
content: '新版本下载失败',
showCancel: false
})
reject(res.data)
}
setTimeout(function () {
wx.hideNavigationBarLoading()
}, 600)
},
fail: function (e) {
reject('网络出错');
wx.hideNavigationBarLoading()
}
})
});
return promise;
},
getToken() {
let that = this;
let u = that.interface.getToken;
wx.login({
success: (result) => {
that.postk(u, {
code: result.code
}).then((r) => {
console.log(r)
wx.setStorageSync('token', r.data.token)
wx.setStorageSync('login', r.data.login_new1)
wx.setStorageSync('gh_login', r.data.login_new2)
wx.setStorageSync('cb_login', r.data.login_new3)
wx.setStorageSync('sq', r.data.sq1)
wx.setStorageSync('gh_sq', r.data.sq2)
wx.setStorageSync('cb_sq', r.data.sq3)
})
},
fail: (res) => { },
complete: (res) => { },
})
},
// 开放商城公共接口
postk: function (url, data, showLoad) {
wx.showNavigationBarLoading()
var promise = new Promise((resolve, reject) => {
//init
let that = this;
let postData = data
// 滨海
let baseUrl = 'https://binhaidispark.w.broing.cn/api'
// 天远甄选
// let baseUrl = 'https://binhaidispark2.w.broing.cn/api'
},
post: function (url, data, showLoad) {
wx.showNavigationBarLoading()
var promise = new Promise((resolve, reject) => {
//init
let that = this;
let postData = data, baseUrl;
// let baseUrl = 'https://binhai.w.broing.cn/api';
// let baseUrl ='http://binhaitest.w.brotop.cn/api'
// 现在用的
// let baseUrl = 'https://binhai.w.broing.cn/api'
// let baseUrl = 'http://binhaitest.w.brotop.cn/api'
// 滨海
var entrance_type = wx.getStorageSync("entrance_type");
if (entrance_type == '1' || entrance_type == '0' || url == '/getopenid/get' || url.indexOf('/wb/wb') > -1) {
//劳保商城入口
baseUrl = 'https://binhai.w.broing.cn/api';
// baseUrl = 'http://binhai.shs.broing.cn/api'
} else if (entrance_type == '2') {
//工会商城入口
baseUrl = 'https://binhaigh.w.broing.cn/api';
// baseUrl = 'http://gonghui.shs.broing.cn/api'
} else if (entrance_type == '3') {
//办公入口
baseUrl = 'https://bgcb.w.broing.cn/api';
}
// 天远甄选
// if (entrance_type == '1' || url == '/getopenid/get' || url.indexOf('address') > -1) {
// //劳保商城入口
// baseUrl = 'https://binhai2.w.broing.cn/api';
// } else if (entrance_type == '2') {
// //工会商城入口
// baseUrl = 'https://binhaigh2.w.broing.cn/api';
// } else if (entrance_type == '3') {
// //工会商城入口
// baseUrl = 'https://bgcb2.w.broing.cn/api';
// }
//网络请求
wx.request({
url: baseUrl + url,
data: postData,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'token': wx.getStorageSync('token') || ''
},
success: function (res) { //返回取得的数据
if (res.data.code == '200') {
resolve(res.data)
} else if (res.data.code == '5000') {
wx.hideLoading();
reject(res.data)
wx.removeStorageSync('login');
wx.showModal({
title: '提示',
content: res.data.msg,
showCancel: false
})
wx.removeStorageSync('token');
setTimeout(() => {
wx.navigateTo({
url: '/pages/register/register?type=1',
})
}, 1200)
} else {
wx.showModal({
title: '提示',
content: res.data.msg,
showCancel: false
})
reject(res.data)
}
setTimeout(function () {
wx.hideNavigationBarLoading()
}, 600)
},
fail: function (e) {
reject('网络出错');
wx.hideNavigationBarLoading()
}
})
});
return promise;
},
getToken() {
let that = this;
let u = that.interface.getToken;
wx.login({
success: (result) => {
that.postk(u, {
code: result.code
}).then((r) => {
console.log(r)
wx.setStorageSync('token', r.data.token)
wx.setStorageSync('login', r.data.login_new1)
wx.setStorageSync('gh_login', r.data.login_new2)
wx.setStorageSync('cb_login', r.data.login_new3)
wx.setStorageSync('sq', r.data.sq1)
wx.setStorageSync('gh_sq', r.data.sq2)
wx.setStorageSync('cb_sq', r.data.sq3)
})
},
fail: (res) => { },
complete: (res) => { },
})
},
// 开放商城公共接口
postk: function (url, data, showLoad) {
wx.showNavigationBarLoading()
var promise = new Promise((resolve, reject) => {
//init
let that = this;
let postData = data
// 滨海
let baseUrl = 'https://binhaidispark.w.broing.cn/api'
// 天远甄选
// let baseUrl = 'https://binhaidispark2.w.broing.cn/api'
//网络请求
wx.request({
url: baseUrl + url,
data: postData,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'token': wx.getStorageSync('token') || ''
// 'token': '' || ''
},
success: function (res) { //返回取得的数据
if (res.data.code == '1') {
resolve(res.data)
} else if (res.data.code == '5000') {
wx.hideLoading();
reject(res.data)
wx.removeStorageSync('token');
wx.removeStorageSync('login');
// wx.navigateTo({
// url: '/pages/register/register?type=1',
// })
} else {
wx.showToast({
title: res.data.msg,
icon: 'none',
//网络请求
wx.request({
url: baseUrl + url,
data: postData,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'token': wx.getStorageSync('token') || ''
// 'token': '' || ''
},
success: function (res) { //返回取得的数据
if (res.data.code == '1') {
resolve(res.data)
} else if (res.data.code == '5000') {
wx.hideLoading();
reject(res.data)
wx.removeStorageSync('token');
wx.removeStorageSync('login');
// wx.navigateTo({
// url: '/pages/register/register?type=1',
// })
} else {
wx.showToast({
title: res.data.msg,
icon: 'none',
})
reject(res.data)
}
setTimeout(function () {
wx.hideNavigationBarLoading()
}, 600)
},
fail: function (e) {
reject('网络出错');
wx.hideNavigationBarLoading()
}
})
reject(res.data)
}
setTimeout(function () {
wx.hideNavigationBarLoading()
}, 600)
},
fail: function (e) {
reject('网络出错');
wx.hideNavigationBarLoading()
}
})
});
return promise;
},
});
return promise;
},
upload(filetype, file) {
upload(filetype, file) {
var promise = new Promise((resolve, reject) => {
wx.showNavigationBarLoading()
wx.showLoading({
title: '上传中',
})
let url = 'https://binhaidispark.w.broing.cn/api/common/upload';
var promise = new Promise((resolve, reject) => {
wx.showNavigationBarLoading()
wx.showLoading({
title: '上传中',
})
let url = 'https://binhaidispark.w.broing.cn/api/common/upload';
let head = {
'token': wx.getStorageSync('token'),
'XX-Device-Type': ''
}
let typename = {
filetype: filetype
}
wx.uploadFile({
url: url, //仅为示例,非真实的接口地址
filePath: file,
name: 'file',
header: head,
formData: typename,
success: function (res) {
console.log('上传文件后', res)
let temdata = JSON.parse(res.data);
console.log(temdata)
let urlobj = {
url: temdata.data.url
}
resolve(urlobj);
},
fail: function (res) {
reject('网络出错');
wx.hideNavigationBarLoading()
wx.hideLoading()
},
complete: () => {
wx.hideNavigationBarLoading()
wx.hideLoading()
},
})
});
return promise;
},
let head = {
'token': wx.getStorageSync('token'),
'XX-Device-Type': ''
}
let typename = {
filetype: filetype
}
wx.uploadFile({
url: url, //仅为示例,非真实的接口地址
filePath: file,
name: 'file',
header: head,
formData: typename,
success: function (res) {
console.log('上传文件后', res)
let temdata = JSON.parse(res.data);
console.log(temdata)
let urlobj = {
url: temdata.data.url
}
resolve(urlobj);
},
fail: function (res) {
reject('网络出错');
wx.hideNavigationBarLoading()
wx.hideLoading()
},
complete: () => {
wx.hideNavigationBarLoading()
wx.hideLoading()
},
})
});
return promise;
},
// 获取个人信息
getInfoFun() {
let that = this;
let u = that.interface.readteacher;
that.post(u, {}).then((r) => {
console.log('3489523498', r)
if (r.code == 200) {
// 获取个人信息
getInfoFun() {
let that = this;
let u = that.interface.readteacher;
that.post(u, {}).then((r) => {
console.log('3489523498', r)
if (r.code == 200) {
wx.setStorageSync('login', r.msg.login_new)
// that.globalData.login_new=r.msg.login_new;
... ... @@ -262,113 +253,108 @@ App({
})
},
getmessagelist() {
let that = this
let url = '/information/get_all';
let data = {
page: 1,
pageNum: 10,
}
this.post(url, data, "POST").then((r) => {
// console.log(r)
// that.setData({
// messagelist: that.data.messagelist.concat(r.msg)
// })
getmessagelist() {
let that = this
let url = '/information/get_all';
let data = {
page: 1,
pageNum: 10,
let newlist = [];
r.msg.forEach(function (value, index, array) {
console.log(newlist)
if (value.status == 1) {
newlist.push(value)
}
})
console.log('77889944556', newlist)
if (newlist.length != 0) {
wx.showTabBarRedDot({
index: 1,
success: function (red) {
this.post(url, data, "POST").then((r) => {
// console.log(r)
// that.setData({
// messagelist: that.data.messagelist.concat(r.msg)
// })
wx.setTabBarBadge({
index: 1,
text: newlist.length.toString(),
let newlist = [];
r.msg.forEach(function (value, index, array) {
console.log(newlist)
if (value.status == 1) {
newlist.push(value)
}
})
}
})
}
console.log('77889944556', newlist)
if (newlist.length != 0) {
wx.showTabBarRedDot({
index: 1,
success: function (red) {
}).catch((err) => { })
},
onShow: function () {
console.log('hahahahhahahahhhahh')
},
wx.setTabBarBadge({
index: 1,
text: newlist.length.toString(),
})
}
})
}
}).catch((err) => { })
},
onShow: function () { },
//接口管理
interface: {
openid: '/getopenid/get', // 获取openid
getcode: '/getopenid/getcode', // 获取验证码,
getToken: '/user/getToken',
readteacher: '/getopenid/readteacher', // 获取个人信息
login: '/getopenid/smslogin', // 登录
jifenlist: '/order/jifenlist', // 积分列表
address: '/address/index', // 地址列表
addaddress: '/address/add', // 添加地址
editaddress: '/address/edit', // 修改地址
deladdress: '/address/delete', // 删除地址
mraddress: '/address/mo', // 修改默认地址
adshow: '/address/editshow', //地址详情(数据回显)
about: '/wb/wb', // 关于我们
order: '/order/orderlist', // 获取订单列表
payorder: '/order/payorder', // 订单页点击支付
disorder: '/order/disorder', // 订单列表取消订单
orderrefund: '/order/orderrefund', // 退换货详情
// upload: 'https://binhai.w.broing.cn/api/common/upload', // 上传图片
upload: 'https://binhai.w.brotop.cn/api',
refund: '/order/refund', // 退货提交
//接口管理
interface: {
openid: '/getopenid/get', // 获取openid
getcode: '/getopenid/getcode', // 获取验证码,
getToken: '/user/getToken',
readteacher: '/getopenid/readteacher', // 获取个人信息
login: '/getopenid/smslogin', // 登录
jifenlist: '/order/jifenlist', // 积分列表
address: '/address/index', // 地址列表
addaddress: '/address/add', // 添加地址
editaddress: '/address/edit', // 修改地址
deladdress: '/address/delete', // 删除地址
mraddress: '/address/mo', // 修改默认地址
adshow: '/address/editshow', //地址详情(数据回显)
about: '/wb/wb', // 关于我们
order: '/order/orderlist', // 获取订单列表
payorder: '/order/payorder', // 订单页点击支付
disorder: '/order/disorder', // 订单列表取消订单
orderrefund: '/order/orderrefund', // 退换货详情
// upload: 'https://binhai.w.broing.cn/api/common/upload', // 上传图片
upload: 'https://binhai.w.brotop.cn/api',
refund: '/order/refund', // 退货提交
delorder: '/order/delorder', // 删除订单
okorder: '/order/okorder', // 确认订单
orderInfo: '/order/orderInfo', // 订单详情
kuaidi: '/kuaidi/kuaidi', //物流信息
collectdel: '/product/collectdel', //收藏删除
collectList: '/getopenid/collectlist', //收藏列表
deleteseach: '/product/deleteseach', //删除搜索历史
order_pay: '/order/pay', //订单支付
now_add: '/order/now_add', //点击结算
hotsreach: '/product/hotsreach', // 热门搜索
searchhis: '/product/searchhis', // 商品搜索历史
search: '/product/search', // 商品搜索结果列表
getPid: '/cap/getpid', // 分类页面
prev_pay: '/shop/prev_pay', // 购物车点击结算
gwcshop: '/shop/gwcshop', //购物车数量修改保存
deletes: '/shop/deletes', //购物车删除
shopcar: '/shop/shopcar', // 购物车页面
now_prev_pay: '/shop/now_prev_pay', // 直接购买
addshop: '/shop/addshop', // 添加购物车
collect: '/product/collect', // 收藏
getInfo: '/product/getInfo', //商品详情
good_list: '/product/get', // 商品
index: '/cap/get', // 首页大小分类
banner: '/banner/index', // 轮播图
notice: '/cap/notice', // 公告
youfei: '/shop/youfei1', // 单算邮费
youfei1: '/shop/youfei', // 購物車邮费
shopcarNum: '/shop/shopcarnum', // 购物车数量
orderlist: '/shop/orderlist', // 订单各状态数量
order_read: '/shop/read', // 订单数
orderMixed: '/order/zhifu',
},
globalData: {
login_new: "",
// 滨海
baseUrlimg: 'https://binhaidispark.w.broing.cn/',
// 天远
// baseUrlimg: 'https://binhaidispark2.w.broing.cn/api',
}
delorder: '/order/delorder', // 删除订单
okorder: '/order/okorder', // 确认订单
orderInfo: '/order/orderInfo', // 订单详情
kuaidi: '/kuaidi/kuaidi', //物流信息
collectdel: '/product/collectdel', //收藏删除
collectList: '/getopenid/collectlist', //收藏列表
deleteseach: '/product/deleteseach', //删除搜索历史
order_pay: '/order/pay', //订单支付
now_add: '/order/now_add', //点击结算
hotsreach: '/product/hotsreach', // 热门搜索
searchhis: '/product/searchhis', // 商品搜索历史
search: '/product/search', // 商品搜索结果列表
getPid: '/cap/getpid', // 分类页面
prev_pay: '/shop/prev_pay', // 购物车点击结算
gwcshop: '/shop/gwcshop', //购物车数量修改保存
deletes: '/shop/deletes', //购物车删除
shopcar: '/shop/shopcar', // 购物车页面
now_prev_pay: '/shop/now_prev_pay', // 直接购买
addshop: '/shop/addshop', // 添加购物车
collect: '/product/collect', // 收藏
getInfo: '/product/getInfo', //商品详情
good_list: '/product/get', // 商品
index: '/cap/get', // 首页大小分类
banner: '/banner/index', // 轮播图
notice: '/cap/notice', // 公告
youfei: '/shop/youfei1', // 单算邮费
youfei1: '/shop/youfei', // 購物車邮费
shopcarNum: '/shop/shopcarnum', // 购物车数量
orderlist: '/shop/orderlist', // 订单各状态数量
order_read: '/shop/read', // 订单数
orderMixed: '/order/zhifu',
},
globalData: {
login_new: "",
// 滨海
baseUrlimg: 'https://binhaidispark.w.broing.cn/',
// 天远
// baseUrlimg: 'https://binhaidispark2.w.broing.cn/api',
}
})
// 滨海wx73497072e7340d61
// 天远wx2980402f625c4f80
\ No newline at end of file
... ...
const app=getApp()
const app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
list: Array
},
/**
* 组件的属性列表
*/
properties: {
list: Array
},
/**
* 组件的初始数据
*/
data: {
/**
* 组件的初始数据
*/
data: {
},
},
/**
* 组件的方法列表
*/
methods: {
look_more(e) {
let login_new=app.globalData.login_new;
if(login_new==0){
wx.showToast({
title: '您还不是会员',
icon:"none"
/**
* 组件的方法列表
*/
methods: {
look_more(e) {
// 2023-10-19 需求是任何人都可以看商品
// let login_new=app.globalData.login_new;
// if(login_new==0){
// wx.showToast({
// title: '您还不是会员',
// icon:"none"
// })
// setTimeout(function(){
// wx.navigateTo({
// url: '/packageA/pages/login/login',
// })
// },1500)
// return false
// }
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: '/packageA/pages/shop_detail/shop_detail?id=' + id
})
setTimeout(function(){
wx.navigateTo({
url: '/packageA/pages/login/login',
})
},1500)
return false
}
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: '/packageA/pages/shop_detail/shop_detail?id=' + id
})
},
},
},
lifetimes: {
created() {
// 在组件实例刚刚被创建时执行
lifetimes: {
created() {
// 在组件实例刚刚被创建时执行
},
attached() {
// 在组件实例进入页面节点树时执行
},
ready() {
// 在组件在视图层布局完成后执行
this.setData({
list: this.properties.list
})
},
attached() {
// 在组件实例进入页面节点树时执行
},
ready() {
// 在组件在视图层布局完成后执行
this.setData({
list: this.properties.list
})
},
detached() {
// 在组件实例被从页面节点树移除时执行
},
}
},
detached() {
// 在组件实例被从页面节点树移除时执行
},
}
})
... ...
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
selected: 0,
autoplay: true,
interval: 5000,
duration: 500,
circular: true,
current: 0,
zcurrent: 0, //用来记录当前swiper对应的索引index
length_num: 9, //指定展示的小分类数量
nav_index: 0,
c_index: 0, //筛选分类下标
page: 1, //页数
price: 'price desc', //价格排序方式
paynum: 'paynum desc', //销量排序方式
stick: 0,
activity: [],
xianshilist: [{}],
day: '',
hou: '',
min: '',
sec: '',
endTime: '',
activitystatus: '',
showtime: false,
status1: '',
status2: '',
title2: '',
scrollTop: '',
pid: '',
logok: '',
typename: 1,
list: [{
pagePath: "/packageA/pages/index/index",
text: "商品",
iconPath: "/images/tabbar/icon_75.png",
selectedIconPath: "/images/tabbar/icon_68.png"
},
{
pagePath: "/packageA/pages/message/message",
text: "消息",
iconPath: "/images/tabbar/message.png",
selectedIconPath: "/images/tabbar/messageactive.png"
},
{
pagePath: "/packageA/pages/shop_cart/shop_cart",
text: "购物车",
iconPath: "/images/tabbar/icon_70.png",
selectedIconPath: "/images/tabbar/icon_73.png"
},
{
pagePath: "/packageA/pages/my/my",
text: "我的",
iconPath: "/images/tabbar/icon_71.png",
selectedIconPath: "/images/tabbar/icon_72.png"
}
]
},
scroll(e) {
// console.log(e.detail.scrollTop)
// if (e.detail.scrollTop >300){
// console.log(8888)
// this.setData({
// stick:1
// })
// }else{
// this.setData({
// stick:0
// })
// }
// console.log(this.data.stick)
},
onLoad: function (options) {
console.log(app.globalData.index)
if (wx.getStorageSync('entrance_type') == '2') {
wx.setNavigationBarTitle({
title: '工会商城'
})
} else if (wx.getStorageSync('entrance_type') == '1') {
wx.setNavigationBarTitle({
title: '劳保商城'
})
} else if (wx.getStorageSync('entrance_type') == '3') {
wx.setNavigationBarTitle({
title: '办公采办'
})
}
if (app.globalData.index == undefined) {
let that = this;
let token = wx.getStorageSync('token');
console.log('woshitoe', token);
if (token != "") {
console.log(9999)
this.getInfoFun()
}
this.get_notice()
this.get_shopnum()
this.getmessagelist();
console.log('998867', this.data.pid)
if (this.data.pid) {
this.get_info(this.data.pid, 2);
} else {
this.get_info(0, 1);
}
// 获取活动专区
this.getzhuanqulist();
this.getxianshi();
setTimeout(function () {
that.setData({
showtime: true
})
}, 990)
}
//控制显示隐藏
this.ishow()
},
// 获取个人信息
getInfoFun() {
let that = this;
let u = app.interface.readteacher;
app.post(u, {}).then((r) => {
console.log('3489523498', r)
if (r.code == 200) {
app.globalData.login_new = r.msg.login_new;
app.globalData.status = r.msg.status;
console.log(app.globalData.status)
// t.setData({
// obj: r.msg
// })
}
})
},
moremiao() {
let token = wx.getStorageSync("token")
if (token == '') {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
/**
* 页面的初始数据
*/
data: {
selected: 0,
autoplay: true,
interval: 5000,
duration: 500,
circular: true,
current: 0,
zcurrent: 0, //用来记录当前swiper对应的索引index
length_num: 9, //指定展示的小分类数量
nav_index: 0,
c_index: 0, //筛选分类下标
page: 1, //页数
price: 'price desc', //价格排序方式
paynum: 'paynum desc', //销量排序方式
stick: 0,
activity: [],
xianshilist: [{}],
day: '',
hou: '',
min: '',
sec: '',
endTime: '',
activitystatus: '',
showtime: false,
status1: '',
status2: '',
title2: '',
scrollTop: '',
pid: '',
logok: '',
typename: 1,
list: [{
pagePath: "/packageA/pages/index/index",
text: "商品",
iconPath: "/images/tabbar/icon_75.png",
selectedIconPath: "/images/tabbar/icon_68.png"
},
{
pagePath: "/packageA/pages/message/message",
text: "消息",
iconPath: "/images/tabbar/message.png",
selectedIconPath: "/images/tabbar/messageactive.png"
},
{
pagePath: "/packageA/pages/shop_cart/shop_cart",
text: "购物车",
iconPath: "/images/tabbar/icon_70.png",
selectedIconPath: "/images/tabbar/icon_73.png"
},
{
pagePath: "/packageA/pages/my/my",
text: "我的",
iconPath: "/images/tabbar/icon_71.png",
selectedIconPath: "/images/tabbar/icon_72.png"
}
]
},
scroll(e) {
// console.log(e.detail.scrollTop)
// if (e.detail.scrollTop >300){
// console.log(8888)
// this.setData({
// stick:1
// })
// }else{
// this.setData({
// stick:0
// })
// }
// console.log(this.data.stick)
},
onLoad: function (options) {
if (options.token) {
wx.setStorageSync('token', options.token)
}
if (wx.getStorageSync('entrance_type') == '2') {
wx.setNavigationBarTitle({
title: '工会商城'
})
} else if (wx.getStorageSync('entrance_type') == '1') {
wx.setNavigationBarTitle({
title: '劳保商城'
})
} else if (wx.getStorageSync('entrance_type') == '3') {
wx.setNavigationBarTitle({
title: '办公采办'
})
}
// if (app.globalData.index == undefined) {
// let that = this;
// let token = wx.getStorageSync('token');
// if (token != "") {
// this.getInfoFun()
// }
// this.get_notice()
// this.get_shopnum()
// this.getmessagelist();
// if (this.data.pid) {
// this.get_info(this.data.pid, 2);
// } else {
// this.get_info(0, 1);
// }
// // 获取活动专区
// this.getzhuanqulist();
// this.getxianshi();
// setTimeout(function () {
// that.setData({
// showtime: true
// })
// }, 990)
// }
//控制显示隐藏
// this.ishow()
},
// 获取个人信息
getInfoFun() {
let that = this;
let u = app.interface.readteacher;
app.post(u, {}).then((r) => {
if (r.code == 200) {
app.globalData.login_new = r.msg.login_new;
app.globalData.status = r.msg.status;
}
}).catch({})
},
moremiao() {
let token = wx.getStorageSync("token")
if (token == '') {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/packageA/pages/register/register',
})
} else if (res.cancel) { }
}
})
} else {
// 2023-10-19 需求是无需登录
// let login_new = wx.getStorageSync("login");
// if (login_new == 0) {
// wx.showToast({
// title: '您还不是会员',
// icon:"none"
// })
// setTimeout(function(){
// wx.navigateTo({
// url: '/pages/login/login',
// })
// },1500)
// return false
// wx.showModal({
// title: '提示',
// content: '您还不是会员',
// success(res) {
// if (res.confirm) {
// wx.navigateTo({
// url: '/packageA/pages/login/login',
// })
// } else if (res.cancel) { }
// }
// })
// return false
// }
wx.navigateTo({
url: '/packageA/pages/register/register',
url: '/packageA/pages/xianshi/xianshi?title2=' + this.data.title2,
})
} else if (res.cancel) { }
}
})
} else {
let login_new = wx.getStorageSync("login");
if (login_new == 0) {
// wx.showToast({
// title: '您还不是会员',
// icon:"none"
// })
// setTimeout(function(){
// wx.navigateTo({
// url: '/pages/login/login',
// })
// },1500)
// return false
wx.showModal({
title: '提示',
content: '您还不是会员',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/packageA/pages/login/login',
})
} else if (res.cancel) { }
}
})
return false
},
// 控制活动专区和限时抢购显示隐藏
ishow() {
let that = this
let url = '//wb/wb';
let data = {}
app.post(url, data, "POST").then((r) => {
that.setData({
status1: r.msg.status1,
status2: r.msg.status2,
title2: r.msg.title2
})
}).catch((err) => { })
},
}
wx.navigateTo({
url: '/packageA/pages/xianshi/xianshi?title2=' + this.data.title2,
})
}
// 限时抢购
getxianshi() {
let that = this
let url = '/special/get_all';
let data = {
page: 1,
pageNum: 6
}
app.post(url, data, "POST").then((r) => {
that.setData({
xianshilist: r.msg.list,
endTime: r.msg.residue_time,
activitystatus: r.msg.status
})
var time = that.date_format(r.msg.residue_time);
that.countDown()
// that.setData({
// messagelist: that.data.messagelist.concat(r.msg)
// })
// console.log(that.data.messagelist)
}).catch((err) => { })
},
},
date_format(micro_second) {
// 总秒数
var second = micro_second;
// var second = Math.floor(micro_second / 1000);
// 天数
var day = Math.floor(second / 3600 / 24);
// 小时
var hr = Math.floor(second / 3600 % 24);
// 分钟
var min = Math.floor(second / 60 % 60);
// 秒
var sec = Math.floor(second % 60);
return day + "天" + hr + "小时" + min + "分钟" + sec + "秒";
},
// 控制活动专区和限时抢购显示隐藏
ishow() {
let that = this
let url = '//wb/wb';
let data = {
// 倒计时
countDown() {
var that = this;
console.log('999', that.data.endTime)
var time = that.data.endTime;
var interval = setInterval(function () {
// 秒数
let day = parseInt(time / (60 * 60 * 24));
let hou = parseInt(time % (60 * 60 * 24) / 3600);
let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
}
app.post(url, data, "POST").then((r) => {
console.log('4456789', r)
that.setData({
status1: r.msg.status1,
status2: r.msg.status2,
title2: r.msg.title2
})
that.setData({
day: that.timeFormat(day),
hou: that.timeFormat(hou),
min: that.timeFormat(min),
sec: that.timeFormat(sec)
})
time--;
if (time <= 0) {
clearInterval(interval);
}
}.bind(this), 1000);
},
}).catch((err) => { })
},
timeFormat(param) {
return param < 10 ? '0' + param : param;
},
// 限时抢购
getxianshi() {
let that = this
let url = '/special/get_all';
let data = {
page: 1,
pageNum: 6
//获取活动专区列表
getzhuanqulist() {
let that = this
let url = '/activity/get_all';
let data = {}
app.post(url, data, "POST").then((r) => {
console.log(r)
that.setData({
activity: r.msg
})
// that.setData({
// messagelist: that.data.messagelist.concat(r.msg)
// })
// console.log(that.data.messagelist)
}).catch((err) => { })
},
}
app.post(url, data, "POST").then((r) => {
console.log(r)
console.log(r.msg.residue_time)
that.setData({
xianshilist: r.msg.list,
endTime: r.msg.residue_time,
activitystatus: r.msg.status
})
var time = that.date_format(r.msg.residue_time);
console.log('9988776', that.data.activitystatus)
that.countDown()
console.log(that.data.xianshilist)
// that.setData({
// messagelist: that.data.messagelist.concat(r.msg)
// })
// console.log(that.data.messagelist)
}).catch((err) => { })
},
date_format(micro_second) {
// 总秒数
var second = micro_second;
// var second = Math.floor(micro_second / 1000);
// 天数
var day = Math.floor(second / 3600 / 24);
// 小时
var hr = Math.floor(second / 3600 % 24);
// 分钟
var min = Math.floor(second / 60 % 60);
// 秒
var sec = Math.floor(second % 60);
return day + "天" + hr + "小时" + min + "分钟" + sec + "秒";
},
// 倒计时
countDown() {
var that = this;
console.log('999', that.data.endTime)
var time = that.data.endTime;
var interval = setInterval(function () {
// 秒数
let day = parseInt(time / (60 * 60 * 24));
let hou = parseInt(time % (60 * 60 * 24) / 3600);
let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
that.setData({
day: that.timeFormat(day),
hou: that.timeFormat(hou),
min: that.timeFormat(min),
sec: that.timeFormat(sec)
})
time--;
if (time <= 0) {
clearInterval(interval);
}
}.bind(this), 1000);
},
timeFormat(param) {
return param < 10 ? '0' + param : param;
},
//获取活动专区列表
getzhuanqulist() {
let that = this
let url = '/activity/get_all';
let data = {}
app.post(url, data, "POST").then((r) => {
console.log(r)
that.setData({
activity: r.msg
})
console.log(that.data.activity)
// that.setData({
// messagelist: that.data.messagelist.concat(r.msg)
// })
// console.log(that.data.messagelist)
}).catch((err) => { })
},
// 活动专区查看更多
seeactive(e) {
let id = e.currentTarget.dataset.id
let token = wx.getStorageSync("token")
if (token == '') {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
// 活动专区查看更多
seeactive(e) {
let id = e.currentTarget.dataset.id
let token = wx.getStorageSync("token")
if (token == '') {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/packageA/pages/register/register',
})
} else if (res.cancel) { }
}
})
} else {
// 2023-10-19 需求是无需登录
// let login_new = wx.getStorageSync('login');
// if (login_new == 0) {
// wx.showModal({
// title: '提示',
// content: '您还不是会员',
// success(res) {
// if (res.confirm) {
// wx.navigateTo({
// url: '/packageA/pages/login/login',
// })
// } else if (res.cancel) { }
// }
// })
// return false
// }
wx.navigateTo({
url: '/packageA/pages/register/register',
url: '/packageA/pages/zhuanqu/zhuanqu?id=' + id,
})
} else if (res.cancel) { }
}
})
} else {
let login_new = wx.getStorageSync('login');
if (login_new == 0) {
wx.showModal({
title: '提示',
content: '您还不是会员',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/packageA/pages/login/login',
})
} else if (res.cancel) { }
}
})
return false
}
wx.navigateTo({
url: '/packageA/pages/zhuanqu/zhuanqu?id=' + id,
})
}
},
},
more() {
let token = wx.getStorageSync("token")
if (token == '') {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/packageA/pages/register/register',
more() {
let token = wx.getStorageSync("token")
if (token == '') {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/packageA/pages/register/register',
})
} else if (res.cancel) { }
}
})
} else if (res.cancel) { }
return false
}
})
return false
}
let login_new = wx.getStorageSync('login');
if (login_new == 0) {
wx.showModal({
title: '提示',
content: '您还不是会员',
success(res) {
if (res.confirm) {
// 2023-10-19 需求是无需登录
// let login_new = wx.getStorageSync('login');
// if (login_new == 0) {
// wx.showModal({
// title: '提示',
// content: '您还不是会员',
// success(res) {
// if (res.confirm) {
// wx.navigateTo({
// url: '/packageA/pages/login/login',
// })
// } else if (res.cancel) { }
// }
// })
// return false
// }
wx.navigateTo({
url: '/packageA/pages/classify/classify',
})
},
//展示所有的小分类
show_all() {
this.setData({
length_num: this.data.length_num == 9 ? this.data.class_arr.length : 9
})
},
// 查看小分类
look_item(e) {
let token = wx.getStorageSync("token")
if (token == '') {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/packageA/pages/register/register',
})
} else if (res.cancel) { }
}
})
} else {
// 2023-10-19 需求是无需登录
// let login_new = wx.getStorageSync('login');
// let gh_login = wx.getStorageSync('gh_login');
// let cb_login = wx.getStorageSync('cb_login');
// let loginType = wx.getStorageSync('entrance_type');
// if (loginType == 1) {
// if (login_new == 0) {
// wx.showModal({
// title: '提示',
// content: '请绑定账户后操作',
// success(res) {
// if (res.confirm) {
// wx.navigateTo({
// url: '/packageA/pages/login/login',
// })
// } else if (res.cancel) {
// }
// }
// })
// return false
// }
// } else if (loginType == 2) {
// if (gh_login == 0) {
// wx.showModal({
// title: '提示',
// content: '请绑定账户后操作',
// success(res) {
// if (res.confirm) {
// wx.navigateTo({
// url: '/packageA/pages/login/login',
// })
// } else if (res.cancel) {
// }
// }
// })
// return false
// }
// } else if (loginType == 3) {
// if (cb_login == 0) {
// wx.showModal({
// title: '提示',
// content: '请绑定账户后操作',
// success(res) {
// if (res.confirm) {
// wx.navigateTo({
// url: '/packageA/pages/login/login',
// })
// } else if (res.cancel) {
// }
// }
// })
// return false
// }
// }
let title = this.data.nav_arr[this.data.nav_index].name
let index = e.currentTarget.dataset.index ? e.currentTarget.dataset.index : 0
let pid = this.data.nav_arr[this.data.nav_index].id
wx.navigateTo({
url: '/packageA/pages/login/login',
url: '/packageA/pages/search/search_result/search_result?title=' + title + "&index=" + index + '&pid=' + pid
})
} else if (res.cancel) { }
}
})
return false
}
wx.navigateTo({
url: '/packageA/pages/classify/classify',
})
},
//展示所有的小分类
show_all() {
this.setData({
length_num: this.data.length_num == 9 ? this.data.class_arr.length : 9
})
},
// 查看小分类
look_item(e) {
let token = wx.getStorageSync("token")
if (token == '') {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/packageA/pages/register/register',
},
//监测轮播图变化
swiperChange(e) {
this.setData({
zcurrent: e.detail.current
})
},
//轮播图
look_more(e) {
let token = wx.getStorageSync("token")
let id = e.currentTarget.dataset.id
let style = e.currentTarget.dataset.style
if (token == '') {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/packageA/pages/register/register',
})
} else if (res.cancel) { }
}
})
} else if (res.cancel) { }
}
})
} else {
let login_new = wx.getStorageSync('login');
let gh_login = wx.getStorageSync('gh_login');
let cb_login = wx.getStorageSync('cb_login');
let loginType = wx.getStorageSync('entrance_type');
if (loginType == 1) {
if (login_new == 0) {
wx.showModal({
title: '提示',
content: '请绑定账户后操作',
success(res) {
if (res.confirm) {
} else {
// 2023-10-19 需求是无需登录
// let login_new = wx.getStorageSync('login');
// if (login_new == 0) {
// wx.showModal({
// title: '提示',
// content: '您还不是会员',
// success(res) {
// if (res.confirm) {
// wx.navigateTo({
// url: '/packageA/pages/login/login',
// })
// } else if (res.cancel) { }
// }
// })
// return false
// }
if (style == 2) {
wx.navigateTo({
url: '/packageA/pages/login/login',
url: '/packageA/pages/outerChain/outerChain?src=' + e.currentTarget.dataset.src
})
} else if (res.cancel) {
}
}
})
return false
}
} else if(loginType == 2){
if (gh_login == 0) {
wx.showModal({
title: '提示',
content: '请绑定账户后操作',
success(res) {
if (res.confirm) {
} else {
wx.navigateTo({
url: '/packageA/pages/login/login',
url: '/packageA/pages/shop_detail/shop_detail?id=' + id
})
} else if (res.cancel) {
}
}
})
return false
}
}else if(loginType == 3){
if (cb_login == 0) {
wx.showModal({
title: '提示',
content: '请绑定账户后操作',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/packageA/pages/login/login',
})
} else if (res.cancel) {
}
},
// 排序
reorder(e) {
let that = this
let index = Number(e.currentTarget.dataset.index)
if (index == 1) {
if (that.data.price == "price") {
that.setData({
price: 'price desc'
})
} else {
that.setData({
price: 'price'
})
}
} else if (index == 2) {
if (that.data.paynum == "paynum") {
that.setData({
paynum: 'paynum desc'
})
} else {
that.setData({
paynum: 'paynum'
})
}
})
return false
}
}
let title = this.data.nav_arr[this.data.nav_index].name
let index = e.currentTarget.dataset.index ? e.currentTarget.dataset.index : 0
let pid = this.data.nav_arr[this.data.nav_index].id
wx.navigateTo({
url: '/packageA/pages/search/search_result/search_result?title=' + title + "&index=" + index + '&pid=' + pid
})
}
},
//监测轮播图变化
swiperChange(e) {
this.setData({
zcurrent: e.detail.current
})
},
//轮播图
look_more(e) {
let token = wx.getStorageSync("token")
let id = e.currentTarget.dataset.id
let style = e.currentTarget.dataset.style
if (token == '') {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/packageA/pages/register/register',
})
} else if (res.cancel) { }
}
})
} else {
let login_new = wx.getStorageSync('login');
if (login_new == 0) {
wx.showModal({
title: '提示',
content: '您还不是会员',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/packageA/pages/login/login',
})
} else if (res.cancel) { }
}
})
return false
}
if (style == 2) {
wx.navigateTo({
url: '/packageA/pages/outerChain/outerChain?src=' + e.currentTarget.dataset.src
this.setData({
c_index: e.currentTarget.dataset.index,
page: 1,
page_type: false
})
} else {
wx.navigateTo({
url: '/packageA/pages/shop_detail/shop_detail?id=' + id
})
}
}
},
//调用排序接口
this.good_list(this.data.pid, e.currentTarget.dataset.index)
},
select_nav(e) {
let index = Number(e.currentTarget.dataset.index)
let id = e.currentTarget.dataset.id;
this.setData({
pid: id
})
// 排序
reorder(e) {
let that = this
let index = Number(e.currentTarget.dataset.index)
if (index == 1) {
if (that.data.price == "price") {
that.setData({
price: 'price desc'
this.setData({
scrollTop: 0
})
} else {
that.setData({
price: 'price'
if (index == this.data.nav_index) {
return
} else {
this.setData({
nav_index: index,
page: 1,
page_type: false,
c_index: 0, //筛选分类下标
price: 'price desc', //价格排序方式
paynum: 'paynum desc' //销量排序方式
})
this.get_info(id, 2)
}
},
// 轮播图
get_banner() {
let url = app.interface.banner
app.post(url, {}).then((res) => {
this.setData({
imgurl: res.msg
})
})
}
} else if (index == 2) {
if (that.data.paynum == "paynum") {
that.setData({
paynum: 'paynum desc'
},
//获取公告
get_notice() {
let that = this
let url = app.interface.notice
app.post(url, {}).then((res) => {
for (let obj of res.msg) {
obj.createtime = obj.createtime.substring(0, 10)
}
that.setData({
notice: res.msg
})
})
} else {
that.setData({
paynum: 'paynum'
},
//获取页面信息
get_info(pid, type) { //type 1为小标题 2为小标题下的小分类
wx.showLoading({
title: '加载中',
mask: true
})
}
}
this.setData({
c_index: e.currentTarget.dataset.index,
page: 1,
page_type: false
})
//调用排序接口
this.good_list(this.data.pid, e.currentTarget.dataset.index)
},
select_nav(e) {
let index = Number(e.currentTarget.dataset.index)
let id = e.currentTarget.dataset.id;
this.setData({
pid: id
})
this.setData({
scrollTop: 0
})
if (index == this.data.nav_index) {
return
} else {
this.setData({
nav_index: index,
page: 1,
page_type: false,
c_index: 0, //筛选分类下标
price: 'price desc', //价格排序方式
paynum: 'paynum desc' //销量排序方式
})
this.get_info(id, 2)
}
},
// 轮播图
get_banner() {
let url = app.interface.banner
app.post(url, {}).then((res) => {
this.setData({
imgurl: res.msg
})
})
},
//获取公告
get_notice() {
let that = this
let url = app.interface.notice
app.post(url, {}).then((res) => {
for (let obj of res.msg) {
obj.createtime = obj.createtime.substring(0, 10)
}
that.setData({
notice: res.msg
})
})
},
//获取页面信息
get_info(pid, type) { //type 1为小标题 2为小标题下的小分类
wx.showLoading({
title: '加载中',
mask: true
})
let that = this
let url = app.interface.index
let params = {
pid: pid
}
app.post(url, params).then((res) => {
console.log('88776654', res)
wx.hideLoading()
if (type == 1) {
let obj = {
name: '首页',
id: ''
let that = this
let url = app.interface.index
let params = {
pid: pid
}
res.msg.unshift(obj)
that.setData({
nav_arr: res.msg
})
that.get_info(res.msg[0].id, 2)
} else if (type == 2) {
console.log('666', res)
// let obj = {
// name: '全部',
// id: ''
// }
// res.msg.unshift(obj)
that.setData({
class_arr: res.msg,
cid: ''
app.post(url, params).then((res) => {
console.log('88776654', res)
wx.hideLoading()
if (type == 1) {
let obj = {
name: '首页',
id: ''
}
res.msg.unshift(obj)
that.setData({
nav_arr: res.msg
})
that.get_info(res.msg[0].id, 2)
} else if (type == 2) {
console.log('666', res)
// let obj = {
// name: '全部',
// id: ''
// }
// res.msg.unshift(obj)
that.setData({
class_arr: res.msg,
cid: ''
})
that.good_list(pid, that.data.c_index)
}
}).catch((er) => {
wx.hideLoading()
})
that.good_list(pid, that.data.c_index)
}
}).catch((er) => {
wx.hideLoading()
})
},
//获取商品列表
good_list(pid, c_index) {
wx.showLoading({
title: '加载中',
mask: true
})
let that = this
let url = app.interface.good_list
let params = {
pid: pid,
page: that.data.page
}
if (c_index == 1) {
params.price = that.data.price
} else if (c_index == 2) {
params.paynum = that.data.paynum
}
app.post(url, params).then((res) => {
let list = res.msg;
for (let obj of list) {
obj.sales = obj.paynum
}
if (that.data.page == 1) {
wx.hideLoading()
that.setData({
shop_arr: list
},
//获取商品列表
good_list(pid, c_index) {
wx.showLoading({
title: '加载中',
mask: true
})
} else {
if (res.msg.length == 0) {
wx.hideLoading()
that.setData({
page_type: true
})
} else {
setTimeout(() => {
wx.hideLoading()
that.setData({
shop_arr: that.data.shop_arr.concat(list)
})
}, 1000)
let that = this
let url = app.interface.good_list
let params = {
pid: pid,
page: that.data.page
}
}
})
},
/**
* 生命周期函数--监听页面加载
*/
//获取购物车数量
get_shopnum() {
let that = this
let url = app.interface.shopcarNum
app.post(url, {}).then((res) => {
if (res.msg > 0) {
wx.showTabBarRedDot({
index: 2,
success: function (red) {
wx.setTabBarBadge({
index: 2,
text: res.msg.toString(),
})
}
})
} else {
wx.hideTabBarRedDot({
index: 2,
if (c_index == 1) {
params.price = that.data.price
} else if (c_index == 2) {
params.paynum = that.data.paynum
}
app.post(url, params).then((res) => {
let list = res.msg;
for (let obj of list) {
obj.sales = obj.paynum
}
if (that.data.page == 1) {
wx.hideLoading()
that.setData({
shop_arr: list
})
} else {
if (res.msg.length == 0) {
wx.hideLoading()
that.setData({
page_type: true
})
} else {
setTimeout(() => {
wx.hideLoading()
that.setData({
shop_arr: that.data.shop_arr.concat(list)
})
}, 1000)
}
}
})
}
})
},
},
getmessagelist() {
let that = this
let url = '/information/get_all';
let data = {
page: 1,
pageNum: 10,
}
app.post(url, data, "POST").then((r) => {
// console.log(r)
// that.setData({
// messagelist: that.data.messagelist.concat(r.msg)
// })
let newlist = [];
r.msg.forEach(function (value, index, array) {
console.log(newlist)
if (value.status == 1) {
newlist.push(value)
/**
* 生命周期函数--监听页面加载
*/
//获取购物车数量
get_shopnum() {
let that = this
let url = app.interface.shopcarNum
app.post(url, {}).then((res) => {
if (res.msg > 0) {
wx.showTabBarRedDot({
index: 2,
success: function (red) {
wx.setTabBarBadge({
index: 2,
text: res.msg.toString(),
})
}
})
} else {
wx.hideTabBarRedDot({
index: 2,
})
}
}).catch(err => {})
},
getmessagelist() {
let that = this
let url = '/information/get_all';
let data = {
page: 1,
pageNum: 10,
}
})
app.post(url, data, "POST").then((r) => {
// console.log(r)
// that.setData({
// messagelist: that.data.messagelist.concat(r.msg)
// })
let newlist = [];
r.msg.forEach(function (value, index, array) {
if (value.status == 1) {
newlist.push(value)
}
})
if (newlist.length != 0) {
wx.showTabBarRedDot({
index: 1,
success: function (red) {
wx.setTabBarBadge({
index: 1,
text: newlist.length.toString(),
})
}
})
}
}).catch((err) => { })
},
// 获取个人信息
console.log('77889944556', newlist)
if (newlist.length != 0) {
wx.showTabBarRedDot({
index: 1,
success: function (red) {
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
wx.setTabBarBadge({
index: 1,
text: newlist.length.toString(),
})
}
})
}
}).catch((err) => { })
},
// 获取个人信息
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData({
logok: app.globalData.baseUrlimg + "assets/img/cb2ad36a391388f19f5f912fa021f8f.png"
})
console.log(this.data.logok)
// this.logok=app.globalData.baseUrlimg+"assets/img/cb2ad36a391388f19f5f912fa021f8f.png''
this.get_banner()
console.log(app.globalData.index)
if (app.globalData.index == 0) {
app.globalData.index = undefined
let token = wx.getStorageSync('token');
console.log('woshitoe', token)
if (token != "") {
this.getInfoFun()
}
this.get_notice()
this.get_shopnum()
this.getmessagelist();
console.log('998867', this.data.pid)
if (this.data.pid) {
this.get_info(this.data.pid, 2);
} else {
this.get_info(0, 1);
}
//控制显示隐藏
this.ishow()
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData({
logok: app.globalData.baseUrlimg + "assets/img/cb2ad36a391388f19f5f912fa021f8f.png"
})
// this.logok=app.globalData.baseUrlimg+"assets/img/cb2ad36a391388f19f5f912fa021f8f.png''
this.get_banner()
// if (app.globalData.index == 0) {
// app.globalData.index = undefined
let token = wx.getStorageSync('token');
if (token != "") {
this.getInfoFun()
}
this.get_notice()
this.get_shopnum()
this.getmessagelist();
if (this.data.pid) {
this.get_info(this.data.pid, 2);
} else {
this.get_info(0, 1);
}
//控制显示隐藏
this.ishow()
// }
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
},
loadMore(e) {
console.log(e)
let that = this
if (that.data.page_type) {
wx.showToast({
title: '暂无更多数据',
icon: 'none',
duration: 1000
})
return
}
that.setData({
page: that.data.page + 1
})
that.good_list(that.data.pid, that.data.c_index)
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
console.log(43898438493)
let that = this
if (that.data.page_type) {
wx.showToast({
title: '暂无更多数据',
icon: 'none',
duration: 1000
})
return
}
that.setData({
page: that.data.page + 1
})
that.good_list(that.data.pid, that.data.c_index)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
loadMore(e) {
console.log(e)
let that = this
if (that.data.page_type) {
wx.showToast({
title: '暂无更多数据',
icon: 'none',
duration: 1000
})
return
}
that.setData({
page: that.data.page + 1
})
that.good_list(that.data.pid, that.data.c_index)
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
console.log(43898438493)
let that = this
if (that.data.page_type) {
wx.showToast({
title: '暂无更多数据',
icon: 'none',
duration: 1000
})
return
}
that.setData({
page: that.data.page + 1
})
that.good_list(that.data.pid, that.data.c_index)
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
... ... @@ -2,166 +2,166 @@
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
page: 1,
messagelist: [],
token:'',
login_new:'',
selected:1,
list:[{
        pagePath: "/packageA/pages/index/index",
        text: "商品",
        iconPath: "/images/tabbar/icon_75.png",
        selectedIconPath: "/images/tabbar/icon_68.png"
      },
      {
        pagePath: "/packageA/pages/message/message",
        text: "消息",
        iconPath: "/images/tabbar/message.png",
        selectedIconPath: "/images/tabbar/messageactive.png"
      },
      {
        pagePath: "/packageA/pages/shop_cart/shop_cart",
        text: "购物车",
        iconPath: "/images/tabbar/icon_70.png",
        selectedIconPath: "/images/tabbar/icon_73.png"
      },
      {
        pagePath"/packageA/pages/my/my",
        text"我的",
        iconPath"/images/tabbar/icon_71.png",
        selectedIconPath"/images/tabbar/icon_72.png"
      }]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
getmessagelist() {
let that = this
let url = '/information/get_all';
let data = {
page: that.data.page,
pageNum: 10,
/**
* 页面的初始数据
*/
data: {
page: 1,
messagelist: [],
token: '',
login_new: '',
selected: 1,
list: [{
pagePath: "/packageA/pages/index/index",
text: "商品",
iconPath: "/images/tabbar/icon_75.png",
selectedIconPath: "/images/tabbar/icon_68.png"
},
{
pagePath: "/packageA/pages/message/message",
text: "消息",
iconPath: "/images/tabbar/message.png",
selectedIconPath: "/images/tabbar/messageactive.png"
},
{
pagePath: "/packageA/pages/shop_cart/shop_cart",
text: "购物车",
iconPath: "/images/tabbar/icon_70.png",
selectedIconPath: "/images/tabbar/icon_73.png"
},
{
pagePath: "/packageA/pages/my/my",
text: "我的",
iconPath: "/images/tabbar/icon_71.png",
selectedIconPath: "/images/tabbar/icon_72.png"
}]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
getmessagelist() {
let that = this
let url = '/information/get_all';
let data = {
page: that.data.page,
pageNum: 10,
}
app.post(url, data, "POST").then((r) => {
console.log(r)
that.setData({
messagelist: that.data.messagelist.concat(r.msg)
})
let newlist = [];
that.data.messagelist.forEach(function(value, index, array) {
console.log(newlist)
if (value.status == 1) {
newlist.push(value)
}
})
console.log(newlist)
if (newlist.length != 0) {
wx.showTabBarRedDot({
index: 1,
success: function(red) {
wx.setTabBarBadge({
index: 1,
text: newlist.length.toString(),
app.post(url, data, "POST").then((r) => {
console.log(r)
that.setData({
messagelist: that.data.messagelist.concat(r.msg)
})
let newlist = [];
that.data.messagelist.forEach(function (value, index, array) {
console.log(newlist)
if (value.status == 1) {
newlist.push(value)
}
})
}
console.log(newlist)
if (newlist.length != 0) {
wx.showTabBarRedDot({
index: 1,
success: function (red) {
wx.setTabBarBadge({
index: 1,
text: newlist.length.toString(),
})
}
})
} else {
wx.hideTabBarRedDot({
index: 1,
success: function (red) {
// wx.setTabBarBadge({
// index: 1,
// text: newlist.length.toString(),
// })
}
})
}
}).catch((err) => { })
},
// 订单详情
ordertail(e) {
let id = e.currentTarget.dataset.id;
wx.navigateTo({
url: '/packageA/pages/messagedetail/messagedetail?id=' + id,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData({
token: wx.getStorageSync('token'),
login_new: app.globalData.login_new
})
}else{
wx.hideTabBarRedDot({
index: 1,
success: function (red) {
// wx.setTabBarBadge({
// index: 1,
// text: newlist.length.toString(),
// })
}
this.setData({
messagelist: [],
page: 1
})
this.getmessagelist()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
let newpage = this.data.page;
newpage++;
this.setData({
page: newpage
})
}
}).catch((err) => {})
},
// 订单详情
ordertail(e) {
let id = e.currentTarget.dataset.id;
wx.navigateTo({
url: '/packageA/pages/messagedetail/messagedetail?id=' + id,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.setData({
token:wx.getStorageSync('token'),
login_new:app.globalData.login_new
})
this.setData({
messagelist: [],
page: 1
})
this.getmessagelist()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
let newpage = this.data.page;
newpage++;
this.setData({
page: newpage
})
this.getmessagelist()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
this.getmessagelist()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
... ... @@ -2,9 +2,9 @@
<navigator class="no_login" catchtap="go_login" url="/packageA/pages/register/register" hover-class="none">请先登录</navigator>
</block>
<block wx:elif="{{login_new==''}}">
<!-- <block wx:elif="{{login_new==''}}">
<navigator class="no_login" catchtap="go_login" url="/packageA/pages/login/login" hover-class="none">请先绑定会员</navigator>
</block>
</block> -->
<block wx:else>
<view class="empty" wx:if="{{messagelist.length==0}}">暂无更多数据</view>
... ...
... ... @@ -125,8 +125,8 @@ Page({
let t = this;
let type = e.currentTarget.dataset.i;
let index = e.currentTarget.dataset.t;
if (wx.getStorageSync("token") && !this.data.noBind && index != 5) {
if (wx.getStorageSync("token") && index != 5) {
// if (wx.getStorageSync("token") && !this.data.noBind && index != 5) {
if (index == 1) {
// 跳转订单列表
wx.navigateTo({
... ... @@ -178,25 +178,25 @@ Page({
return false
}
if(this.data.noBind){
wx.showModal({
title: '提示',
content: '请绑定账号后操作',
confirmText:'去绑定',
cancelText:'取消',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/packageA/pages/login/login',
})
} else if (res.cancel) {
}
}
})
// 2023-10-19 需求取消登录限制
// if(this.data.noBind){
// wx.showModal({
// title: '提示',
// content: '请绑定账号后操作',
// confirmText:'去绑定',
// cancelText:'取消',
// success(res) {
// if (res.confirm) {
// wx.navigateTo({
// url: '/packageA/pages/login/login',
// })
// } else if (res.cancel) {
// }
// }
// })
return false
}
// return false
// }
}
},
//获取购物车数量
... ...
... ... @@ -14,13 +14,13 @@
</view>
<!-- <view class="company">{{obj.competition}}</view> -->
<view class="info_box" wx:if="{{noBind}}">
<!-- <view class="info_box" wx:if="{{noBind}}">
<view class="bindNote">点击绑定账号</view>
</view>
<view class="info_box" wx:else>
</view> -->
<view class="info_box">
<view>{{obj.job?obj.job:'暂无'}}</view>
<!-- <view>{{obj.section?obj.section:'暂无'}}</view> -->
<view>{{obj.tel}}</view>
<view>{{obj.tel?obj.tel:''}}</view>
</view>
</view>
</view>
... ...
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
success: false,
fail: false,
name: '',
choudanNum:0,
addressId: 0,
tel: '',
area: '',
address: '',
cover_type: false,
total:'',
info:{
address:{
address:'',
area:'',
id:'',
tel:'',
name:''
}
}
},
//加减商品数量
num_change(e) {
let that = this
let num = Number(e.currentTarget.dataset.num)
console.log(num)
let type = e.currentTarget.dataset.type
let index = e.currentTarget.dataset.index
let id = e.currentTarget.dataset.id
let check = e.currentTarget.dataset.check
let coudan = this.data.coudan||[]
let coudan_arr = this.data.coudan_arr||[]
let price = e.currentTarget.dataset.price;
let price2 = e.currentTarget.dataset.price2;
if (type == 1) {
if(this.data.info.choudan*100<(price*100)){
wx.showToast({
title: '当前剩余积分不足,请重新挑选',
icon:'none'
})
return
}
num++
} else {
num--
if (num < 0) {
num = 0;
return
}
}
/**
* 页面的初始数据
*/
data: {
success: false,
fail: false,
name: '',
choudanNum: 0,
addressId: 0,
tel: '',
area: '',
address: '',
cover_type: false,
total: '',
info: {
address: {
address: '',
area: '',
id: '',
tel: '',
name: ''
}
}
},
//加减商品数量
num_change(e) {
let that = this
let num = Number(e.currentTarget.dataset.num)
console.log(num)
let type = e.currentTarget.dataset.type
let index = e.currentTarget.dataset.index
let id = e.currentTarget.dataset.id
let check = e.currentTarget.dataset.check
let coudan = this.data.coudan || []
let coudan_arr = this.data.coudan_arr || []
let price = e.currentTarget.dataset.price;
let price2 = e.currentTarget.dataset.price2;
if (num<1) {
coudan.forEach((item, index) => {
if (item.id == id) {
coudan.splice(index, 1)
coudan_arr.splice(index, 1)
if (type == 1) {
if (this.data.info.choudan * 100 < (price * 100)) {
wx.showToast({
title: '当前剩余积分不足,请重新挑选',
icon: 'none'
})
return
}
num++
} else {
num--
if (num < 0) {
num = 0;
return
}
}
})
} else {
if(type==1&&num==1){
if (num < 1) {
coudan.forEach((item, index) => {
if (item.id == id) {
coudan.splice(index, 1)
coudan_arr.splice(index, 1)
}
})
} else {
if (type == 1 && num == 1) {
//选中
coudan.push({
id: id,
num: num
})
coudan_arr.push({
id: id,
num: num,
price: Number(price),
price2:Number(price2)
})
}else{
coudan.forEach((item, index) => {
if (item.id == id) {
item.num = num
coudan_arr[index].num = num
coudan.push({
id: id,
num: num
})
coudan_arr.push({
id: id,
num: num,
price: Number(price),
price2: Number(price2)
})
} else {
coudan.forEach((item, index) => {
if (item.id == id) {
item.num = num
coudan_arr[index].num = num
}
})
}
}
that.setData({
coudan: coudan,
coudan_arr: coudan_arr,
[`info.coudanProduct[${index}].num`]: num
// [`info.coudanProduct[${index}].check`]: check
})
this.get_choudan()
},
// 计算凑单费用
get_choudan() {
let coudan_arr = this.data.coudan_arr
let choudan_money = 0;
let num = 0
for (let obj of coudan_arr) {
console.log(obj)
console.log(obj.price2)
if (obj.price2 != null) {
console.log(111)
choudan_money = (obj.price2 * 100 * obj.num) / 100 + choudan_money
} else {
console.log(222)
choudan_money = (obj.price * 100 * obj.num) / 100 + choudan_money
}
})
num = num + obj.num
}
}
that.setData({
coudan: coudan,
coudan_arr: coudan_arr,
[`info.coudanProduct[${index}].num`]: num
// [`info.coudanProduct[${index}].check`]: check
})
this.get_choudan()
},
// 计算凑单费用
get_choudan() {
let coudan_arr = this.data.coudan_arr
let choudan_money = 0;
let num = 0
for (let obj of coudan_arr) {
console.log(obj)
console.log(obj.price2)
if (obj.price2!= null) {
console.log(111)
choudan_money = (obj.price2 * 100 * obj.num) / 100 + choudan_money
} else {
console.log(222)
choudan_money = (obj.price * 100 * obj.num) / 100 + choudan_money
}
num = num+obj.num
}
this.setData({
choudan_money: choudan_money * 100,
choudanNum: num,
'info.choudan': this.data.info.syjf - choudan_money
// choudan_money: Math.floor(choudan_money* 100) / 100
})
},
show_cover() {
let that = this
if (!that.data.cover_type) {
if (that.data.info.status == 0) {
that.setData({
fail: true
})
return
}
if (!that.data.info.address) {
wx.showToast({
title: '请添加地址',
icon: 'none',
duration: 1000
})
return
}
}
that.setData({
cover_type: !this.data.cover_type
})
},
// 去添加地址
add_address() {
wx.navigateTo({
url: '/packageA/pages/address/address',
})
},
this.setData({
choudan_money: choudan_money*100,
choudanNum:num,
'info.choudan': this.data.info.syjf - choudan_money
// choudan_money: Math.floor(choudan_money* 100) / 100
})
},
show_cover() {
let that = this
if (!that.data.cover_type) {
if (that.data.info.status == 0) {
//选择凑单商品
chooseGoods(e) {
// coudan 凑单商品组成的数组
// coudan_type 凑单的状态 可能废弃
let that = this
let coudan = this.data.coudan ? this.data.coudan : []
let coudan_arr = this.data.coudan_arr ? this.data.coudan_arr : []
let check = e.currentTarget.dataset.check
let num = e.currentTarget.dataset.num
let index = e.currentTarget.dataset.index
let id = e.currentTarget.dataset.id
let price = e.currentTarget.dataset.price;
let price2 = e.currentTarget.dataset.price2;
if (check) {
check = 0
coudan.forEach((item, index) => {
if (item.id == id) {
coudan.splice(index, 1)
coudan_arr.splice(index, 1)
}
})
} else {
check = 1
//选中
coudan.push({
id: id,
num: num
})
coudan_arr.push({
id: id,
num: num,
price: Number(price),
price2: Number(price2)
})
}
that.setData({
fail: true
coudan: coudan,
coudan_arr: coudan_arr,
[`info.coudanProduct[${index}].check`]: check
})
return
}
if (!that.data.info.address) {
wx.showToast({
title: '请添加地址',
icon: 'none',
duration: 1000
that.get_choudan()
},
//获取页面信息
get_info(type, info, id) {
let that = this
let url = type == 4 ? app.interface.prev_pay : app.interface.now_prev_pay
let params = {
info: info
}
app.post(url, params).then((res) => {
console.log('99999', res, Number(res.msg.total))
res.msg.syjf = res.msg.choudan - res.msg.yunfei
res.msg.choudan = res.msg.choudan - res.msg.yunfei
res.msg.total = Number(res.msg.total * 100)
res.msg.yunfei = Number(res.msg.yunfei * 100)
let total = (res.msg.total + res.msg.yunfei).toFixed("1");
console.log(total)
that.setData({
info: res.msg,
total: total
})
})
return
}
}
that.setData({
cover_type: !this.data.cover_type
})
},
// 去添加地址
add_address() {
wx.navigateTo({
url: '/packageA/pages/address/address',
})
},
//选择凑单商品
chooseGoods(e) {
// coudan 凑单商品组成的数组
// coudan_type 凑单的状态 可能废弃
let that = this
let coudan = this.data.coudan ? this.data.coudan : []
let coudan_arr = this.data.coudan_arr ? this.data.coudan_arr : []
let check = e.currentTarget.dataset.check
let num = e.currentTarget.dataset.num
let index = e.currentTarget.dataset.index
let id = e.currentTarget.dataset.id
let price = e.currentTarget.dataset.price;
let price2 = e.currentTarget.dataset.price2;
if (check) {
check = 0
coudan.forEach((item, index) => {
if (item.id == id) {
coudan.splice(index, 1)
coudan_arr.splice(index, 1)
},
//获取页面信息
get_youfei(id) {
let that = this
let url = that.data.type == 4 ? app.interface.youfei1 : app.interface.youfei
let params = {
info: that.data.params,
address_id: id
}
})
} else {
check = 1
//选中
coudan.push({
id: id,
num: num
})
coudan_arr.push({
id: id,
num: num,
price: Number(price),
price2:Number(price2)
})
}
that.setData({
coudan: coudan,
coudan_arr: coudan_arr,
[`info.coudanProduct[${index}].check`]: check
})
that.get_choudan()
},
//获取页面信息
get_info(type, info, id) {
let that = this
let url = type == 4 ? app.interface.prev_pay : app.interface.now_prev_pay
let params = {
info: info
}
app.post(url, params).then((res) => {
console.log('99999', res, Number(res.msg.total))
res.msg.syjf = res.msg.choudan - res.msg.yunfei
res.msg.choudan = res.msg.choudan - res.msg.yunfei
res.msg.total = Number(res.msg.total * 100)
res.msg.yunfei = Number(res.msg.yunfei * 100)
let total = (res.msg.total + res.msg.yunfei).toFixed("1");
console.log(total)
that.setData({
info: res.msg,
total:total
})
console.log('9988756', that.data.info)
})
},
//获取页面信息
get_youfei(id) {
let that = this
let url = that.data.type == 4 ? app.interface.youfei1 : app.interface.youfei
let params = {
info: that.data.params,
address_id: id
}
app.post(url, params).then((res) => {
that.setData({
"info.yunfei": Number(res.msg.yunfei)*100
})
})
},
//点击支付
submit() {
let that = this
let list = that.data.info.products
let coudan = that.data.coudan
let info = []
if (that.data.type == 4) {
for (let obj of list) {
info.push({
id: obj.product.id,
num: obj.product.num
app.post(url, params).then((res) => {
that.setData({
"info.yunfei": Number(res.msg.yunfei) * 100
})
})
}
} else {
for (let obj of list) {
info.push({
id: obj.id,
num: obj.num
},
//点击支付
submit() {
let that = this
let list = that.data.info.products
let coudan = that.data.coudan
let info = []
if (that.data.type == 4) {
for (let obj of list) {
info.push({
id: obj.product.id,
num: obj.product.num
})
}
} else {
for (let obj of list) {
info.push({
id: obj.id,
num: obj.num
})
}
}
if (coudan && coudan.length > 0) {
info = info.concat(coudan)
}
let url = app.interface.now_add
let params = {
address: that.data.info.address.id,
info: JSON.stringify(info)
}
app.post(url, params).then((res) => {
that.setData({
cover_type: false
})
that.order_pay(res.msg)
})
}
}
if (coudan && coudan.length > 0) {
info = info.concat(coudan)
}
let url = app.interface.now_add
let params = {
address: that.data.info.address.id,
info: JSON.stringify(info)
}
app.post(url, params).then((res) => {
that.setData({
cover_type: false
})
that.order_pay(res.msg)
})
},
//订单支付
order_pay(order_odd) {
let url = app.interface.order_pay
let params = {
order_odd: order_odd
}
app.post(url, params).then((res) => {
this.setData({
order: res.msg
})
if (res.msg.message == "支付成功") {
// wx.showToast({
// title: '购买成功',
// icon:'none'
// })
this.setData({
success: true
},
//开放订单支付
order_pay(order_odd) {
let that = this;
let url = app.interface.order_pay
let params = {
order_odd: order_odd
}
app.post(url, params).then((res) => {
that.payment(res.msg)
})
} else if (res.msg.message == "余额不足") {
},
payment(res) {
var timeStamp = res.timeStamp.toString();
wx.requestPayment({
timeStamp: timeStamp,
nonceStr: res.nonceStr,
package: res.package,
signType: res.signType,
paySign: res.paySign,
success: function (res) {
wx.redirectTo({
url: '/packageA/pages/order/order_list/order_list?status=3',
})
},
fail: function (res) {
console.log(res);
}
})
},
//订单支付
// order_pay(order_odd) {
// let url = app.interface.order_pay
// let params = {
// order_odd: order_odd
// }
// app.post(url, params).then((res) => {
// this.setData({
// order: res.msg
// })
// if (res.msg.message == "支付成功") {
// // wx.showToast({
// // title: '购买成功',
// // icon:'none'
// // })
// this.setData({
// success: true
// })
// } else if (res.msg.message == "余额不足") {
// this.setData({
// fail: true
// })
// }
// })
// },
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
this.setData({
fail: true
type: options.type,
params: options.info
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
console.log(options)
this.setData({
type: options.type,
params: options.info
})
this.get_info(options.type, options.info, options.id)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
let pages = getCurrentPages();
let currPage = pages[pages.length - 1]
console.log('887766554',currPage.data.id)
if (currPage.data.id) {
console.log('4778785',this.data.info)
this.setData({
"info.address.address": currPage.data.address,
"info.address.area": currPage.data.area,
"info.address.id": currPage.data.id,
"info.address.tel": currPage.data.tel,
"info.address.name": currPage.data.name
})
console.log(this.data.info)
console.log(currPage.data.address)
this.get_youfei(currPage.data.id)
}
// if (wx.getStorageSync('no_address')) {
// wx.setStorageSync('no_address', false)
// this.setData({
// "info.address": null
// })
// }
this.get_info(options.type, options.info, options.id)
},
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
let pages = getCurrentPages();
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
let currPage = pages[pages.length - 1]
if (currPage.data.id) {
this.setData({
"info.address.address": currPage.data.address,
"info.address.area": currPage.data.area,
"info.address.id": currPage.data.id,
"info.address.tel": currPage.data.tel,
"info.address.name": currPage.data.name
})
this.get_youfei(currPage.data.id)
}
// if (wx.getStorageSync('no_address')) {
// wx.setStorageSync('no_address', false)
// this.setData({
// "info.address": null
// })
// }
},
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
}
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
... ... @@ -63,10 +63,10 @@
<view class='score'>{{info.date}}</view>
</view>
<view class='mask_two'>
<!-- <view class='mask_two'>
<view>邮费</view>
<view class='score' style="color:rgba(242, 0, 0, 1)">{{info.yunfei/100}}积分</view>
</view>
</view> -->
</view>
</view>
</view>
... ... @@ -75,7 +75,8 @@
<view class="submit" catchtap="show_cover">提交</view>
<view class="jifen"> 合计:
<!-- <text>{{choudan_money?choudan_money + info.total + info.yunfei*100/100: info.total + info.yunfei*100/100}}积分</text> -->
<text>{{choudan_money?(choudan_money + info.total + info.yunfei)/100: (info.total + info.yunfei)/100}}积分</text>
<!-- <text>{{choudan_money?(choudan_money + info.total + info.yunfei)/100: (info.total + info.yunfei)/100}}积分</text> -->
<text>¥{{choudan_money?(choudan_money + info.total + info.yunfei)/100: (info.total + info.yunfei)/100}}</text>
</view>
<view class="num">共{{info.totalnum + choudanNum}}件</view>
</view>
... ... @@ -109,15 +110,17 @@
<view class="cover_box" wx:if="{{cover_type}}">
<view class="cover_order">
<view class="all_money">{{choudan_money?(choudan_money + info.total + info.yunfei)/100: (info.total + info.yunfei)/100}}积分</view>
<!-- <view class="all_money">{{choudan_money?(choudan_money + info.total + info.yunfei)/100: (info.total + info.yunfei)/100}}积分</view> -->
<view class="all_money">¥{{choudan_money?(choudan_money + info.total + info.yunfei)/100: (info.total + info.yunfei)/100}}</view>
<view class="money_item">
<text>商品积分</text>
<text>{{choudan_money?(choudan_money + info.total)/100:info.total/100}}积分</text>
<text>商品价格</text>
<!-- <text>{{choudan_money?(choudan_money + info.total)/100:info.total/100}}积分</text> -->
<text>¥{{choudan_money?(choudan_money + info.total)/100:info.total/100}}</text>
</view>
<view class="money_item">
<!-- <view class="money_item">
<text>邮费</text>
<text>{{info.yunfei/100}}积分</text>
</view>
</view> -->
<view class="cover_submit" catchtap="submit">确认支付</view>
<image src="/images/close.png" class="cover_close" catchtap="show_cover" />
</view>
... ...
... ... @@ -24,8 +24,8 @@
<view class="word">{{item.product_name}}</view>
<view class="info">
<view class="jifen">
<view class="name">积分</view>
<text>{{item.product_money}}</text>
<!-- <view class="name">积分</view> -->
<text>¥{{item.product_money}}</text>
<text style="margin-left: 10rpx;color:#ccc;font-size: 28rpx;">X{{item.num}}</text>
</view>
</view>
... ... @@ -36,8 +36,8 @@
<view class="info_box" wx:if="{{type == 3}}">
<view class="f_item">
<view class="shop">
商品积分
<text>{{item.price*100*item.num/100}}积分</text>
商品价格
<text>¥{{item.price*100*item.num/100}}</text>
</view>
</view>
</view>
... ... @@ -58,10 +58,10 @@
<view class='score'>{{info.status_text}}</view>
</view>
<view class='mask_two'>
<!-- <view class='mask_two'>
<view>邮费</view>
<view class='score' style="color:rgba(242, 0, 0, 1)">{{info.youfei}}积分</view>
</view>
</view> -->
</view>
</view>
... ... @@ -71,7 +71,7 @@
<view class="footer" wx:if="{{type==2}}">
<view class="submit" catchtap="show_cover">提交</view>
<view class="jifen"> 合计:
<text>{{info.money}}积分</text>
<text>¥{{info.money}}</text>
</view>
<view class="num">共{{info.total_num}}件</view>
</view>
... ... @@ -109,15 +109,15 @@
<view class="cover_box" wx:if="{{cover_type}}">
<view class="cover_order">
<view class="all_money">{{info.total_price + info.youfei*100/100}}积分</view>
<view class="all_money">¥{{info.total_price + info.youfei*100/100}}</view>
<view class="money_item">
<text>商品积分</text>
<text>{{info.total_price}}积分</text>
<text>商品价格</text>
<text>¥{{info.total_price}}</text>
</view>
<view class="money_item">
<!-- <view class="money_item">
<text>邮费</text>
<text>{{info.youfei}}积分</text>
</view>
</view> -->
<view class="cover_submit" catchtap="order_pay" data-order="{{info.order_odd}}">确认支付</view>
<image src="/images/close.png" class="cover_close" catchtap="show_cover" />
</view>
... ...
const a = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
status: 1,
nav: ['待支付', '待发货', '待收货', '已完成', '退换货'],
daiorder: [],
daifahuoorder: [],
daishouhuoorder: [],
success: [],
tui: [],
cover_type: false,
totalmoney:""
},
// 展示待支付的去支付弹窗
show_cover(e) {
if( a.globalData.status==0){
wx.showToast({
title: '您已您所在单位暂未开始劳保购买!',
icon:'none'
})
return false
}
if (e.currentTarget.dataset.d) {
let index = Number(e.currentTarget.dataset.index)
let daiorder = this.data.daiorder
this.setData({
info: daiorder[index]
})
console.log(this.data.info)
this.setData({
totalmoney: Number(this.data.info.total_price)+Number(this.data.info.youfei)
})
}
this.setData({
cover_type: !this.data.cover_type
})
},
//查看物流
look_logistics(e) {
wx.navigateTo({
url: '/packageA/pages/logistics/logistics?order=' + e.currentTarget.dataset.d
})
},
//查看订单详情
orderagain(e) {
let item=e.currentTarget.dataset.item;
let num=e.currentTarget.dataset.num;
let goodid=[]
item.forEach(function(value,index,array){
goodid.push(value.id)
})
let id=e.currentTarget.dataset.id;
/**
* 页面的初始数据
*/
let that = this
let url = '/shop/recur_order'
let params = {
order_id:id
}
a.post(url, params).then((res) => {
// that.setData({
// "info.shop": Number(that.data.info.shop) + that.data.num,
// num: 1
// })
wx.showModal({
title: '提示',
content: '加入成功,是否跳到购物车',
success(res) {
if (res.confirm) {
console.log('用户点击确定')
wx.redirectTo({
url: '/packageA/pages/shop_cart/shop_cart',
data: {
status: 1,
nav: ['待支付', '待发货', '待收货', '已完成', '退换货'],
daiorder: [],
daifahuoorder: [],
daishouhuoorder: [],
success: [],
tui: [],
cover_type: false,
totalmoney: ""
},
// 展示待支付的去支付弹窗
show_cover(e) {
if (a.globalData.status == 0) {
wx.showToast({
title: '您已您所在单位暂未开始劳保购买!',
icon: 'none'
})
}
return false
}
})
if (e.currentTarget.dataset.d) {
let index = Number(e.currentTarget.dataset.index)
let daiorder = this.data.daiorder
this.setData({
info: daiorder[index]
})
this.setData({
totalmoney: Number(this.data.info.total_price) + Number(this.data.info.youfei)
})
}
this.setData({
cover_type: !this.data.cover_type
})
},
//查看物流
look_logistics(e) {
wx.navigateTo({
url: '/packageA/pages/logistics/logistics?order=' + e.currentTarget.dataset.d
})
},
//查看订单详情
orderagain(e) {
let item = e.currentTarget.dataset.item;
let num = e.currentTarget.dataset.num;
let goodid = []
item.forEach(function (value, index, array) {
goodid.push(value.id)
})
let id = e.currentTarget.dataset.id;
let that = this
let url = '/shop/recur_order'
let params = {
order_id: id
}
a.post(url, params).then((res) => {
// that.setData({
// "info.shop": Number(that.data.info.shop) + that.data.num,
// num: 1
// })
wx.showModal({
title: '提示',
content: '加入成功,是否跳到购物车',
success(res) {
if (res.confirm) {
console.log('用户点击确定')
wx.redirectTo({
url: '/packageA/pages/shop_cart/shop_cart',
})
}
}
})
// wx.switchTab({
// url: '/pages/shop_cart/shop_cart',
// })
})
// console.log(6666)
// wx.navigateTo({
// url: '/pages/order/order_detail/order_detail?id=' + e.currentTarget.dataset.id+'&type='+e.currentTarget.dataset.type,
// })
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.setData({
status: options.type
})
this.order_read(options.type)
},
//切换导航
changeNav(e) {
var status = e.currentTarget.dataset.index;
this.setData({
status: status
})
this.order_read(status)
this.getListFun()
},
// 检测订单列表已读准通过台
order_read(status) {
let that = this;
let url = a.interface.order_read
let params = {
style: status > 0 ? (status > 1 ? (status > 2 ? (status > 3 ? 'tui' : 'success') : 'daishouhuoorder') : 'daifahuoorder') : 'daiorder'
}
a.post(url, params).then((r) => {
}).catch((er) => {})
},
// 获取订单列表
getListFun() {
let t = this;
let u = a.interface.order;
a.post(u, {}).then((r) => {
if (r.code == 200) {
t.setData({
daiorder: r.msg.daiorder,
daifahuoorder: r.msg.daifahuoorder,
daishouhuoorder: r.msg.daishouhuoorder,
success: r.msg.success,
tui: r.msg.tui,
// wx.switchTab({
// url: '/pages/shop_cart/shop_cart',
// })
})
}
}).catch((er) => {})
},
// 支付订单
payFun(e) {
let t = this;
let u = a.interface.order_pay;
let d = {
order_odd: e.currentTarget.dataset.d
}
a.post(u, d).then((r) => {
this.setData({
cover_type: false
})
if (r.code == 200) {
wx.showToast({
title: r.msg.message,
icon: r.msg.message == '支付成功"' ? 'success' : 'none',
duration: 1300
// console.log(6666)
// wx.navigateTo({
// url: '/pages/order/order_detail/order_detail?id=' + e.currentTarget.dataset.id+'&type='+e.currentTarget.dataset.type,
// })
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
status: options.type
})
setTimeout(() => {
t.getListFun()
}, 1300)
}
}).catch((er) => {})
},
this.order_read(options.type)
},
// 取消订单
celFun(e) {
let t = this;
let u = a.interface.disorder;
let d = {
order_odd: e.currentTarget.dataset.d
}
a.post(u, d).then((r) => {
if (r.code == 200) {
wx.showToast({
title: r.msg,
icon: 'none',
duration: 1300
//切换导航
changeNav(e) {
var status = e.currentTarget.dataset.index;
this.setData({
status: status
})
setTimeout(() => {
t.getListFun()
}, 1300)
}
}).catch((er) => {})
},
this.order_read(status)
this.getListFun()
},
// 检测订单列表已读准通过台
order_read(status) {
let that = this;
let url = a.interface.order_read
let params = {
style: status > 0 ? (status > 1 ? (status > 2 ? (status > 3 ? 'tui' : 'success') : 'daishouhuoorder') : 'daifahuoorder') : 'daiorder'
}
a.post(url, params).then((r) => {
}).catch((er) => { })
},
// 获取订单列表
getListFun() {
let t = this;
let u = a.interface.order;
a.post(u, {}).then((r) => {
if (r.code == 200) {
t.setData({
daiorder: r.msg.daiorder,
daifahuoorder: r.msg.daifahuoorder,
daishouhuoorder: r.msg.daishouhuoorder,
success: r.msg.success,
tui: r.msg.tui,
})
}
}).catch((er) => { })
},
// 确认收货
queren(e) {
let t = this;
let u = a.interface.okorder;
let d = {
order_odd: e.currentTarget.dataset.d
}
a.post(u, d).then((r) => {
if (r.code == 200) {
wx.showToast({
title: r.msg,
icon: 'none',
duration: 1300
// 支付订单
payFun(e) {
let t = this;
let u = a.interface.order_pay;
let d = {
order_odd: e.currentTarget.dataset.d
}
a.post(u, d).then((r) => {
this.setData({
cover_type: false
})
t.payment(r.msg)
// if (r.code == 200) {
// wx.showToast({
// title: r.msg.message,
// icon: r.msg.message == '支付成功"' ? 'success' : 'none',
// duration: 1300
// })
// setTimeout(() => {
// t.getListFun()
// }, 1300)
// }
}).catch((er) => { })
},
payment(res) {
let that = this;
var timeStamp = res.timeStamp.toString();
wx.requestPayment({
timeStamp: timeStamp,
nonceStr: res.nonceStr,
package: res.package,
signType: res.signType,
paySign: res.paySign,
success: function (res) {
console.log(res)
that.setData({
page: 1,
daiorder: [],
cover_type: false
})
that.getListFun()
},
fail: function (res) {
console.log(res);
}
})
setTimeout(() => {
t.getListFun()
}, 1300)
}
}).catch((er) => {})
},
//删除订单
delete_item(e) {
let t = this;
let u = a.interface.delorder;
let d = {
order_odd: e.currentTarget.dataset.d
}
a.post(u, d).then((r) => {
if (r.code == 200) {
wx.showToast({
title: r.msg,
icon: 'none',
duration: 1300
},
// 取消订单
celFun(e) {
let t = this;
let u = a.interface.disorder;
let d = {
order_odd: e.currentTarget.dataset.d
}
a.post(u, d).then((r) => {
if (r.code == 200) {
wx.showToast({
title: r.msg,
icon: 'none',
duration: 1300
})
setTimeout(() => {
t.getListFun()
}, 1300)
}
}).catch((er) => { })
},
// 确认收货
queren(e) {
let t = this;
let u = a.interface.okorder;
let d = {
order_odd: e.currentTarget.dataset.d
}
a.post(u, d).then((r) => {
if (r.code == 200) {
wx.showToast({
title: r.msg,
icon: 'none',
duration: 1300
})
setTimeout(() => {
t.getListFun()
}, 1300)
}
}).catch((er) => { })
},
//删除订单
delete_item(e) {
let t = this;
let u = a.interface.delorder;
let d = {
order_odd: e.currentTarget.dataset.d
}
a.post(u, d).then((r) => {
if (r.code == 200) {
wx.showToast({
title: r.msg,
icon: 'none',
duration: 1300
})
t.getListFun()
}
}).catch((er) => { })
},
// 退换货跳转页面详情
jumpReturnFun(e) {
wx.navigateTo({
url: '/packageA/pages/order/return_goods/return_goods?d=' + e.currentTarget.dataset.d + "&&t=" + e.currentTarget.dataset.t,
})
t.getListFun()
}
}).catch((er) => {})
},
// 退换货跳转页面详情
jumpReturnFun(e) {
wx.navigateTo({
url: '/packageA/pages/order/return_goods/return_goods?d=' + e.currentTarget.dataset.d + "&&t=" + e.currentTarget.dataset.t,
})
},
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.getListFun();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getListFun();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
}
})
\ No newline at end of file
... ...
... ... @@ -17,8 +17,8 @@
<view class='info_titles'>{{zitem.product_name}}</view>
<view class='two_ones'>
<view class='scores'>积分</view>
<view class='prices'>{{zitem.product_money}}</view>
<!-- <view class='scores'>积分</view> -->
<view class='prices'>¥{{zitem.product_money}}</view>
<view class='prices' style="margin-left: 10rpx;color:#ccc;font-size: 28rpx;">X{{zitem.num}}</view>
</view>
</view>
... ... @@ -44,13 +44,13 @@
<view class='mask_two'>
<view>商品积分</view>
<view class='score'>{{item.total_price*100/100}}积分</view>
<view>商品价格</view>
<view class='score'>¥{{item.total_price*100/100}}</view>
</view>
<view class='mask_two no_border'>
<!-- <view class='mask_two no_border'>
<view>邮费积分</view>
<view class='score'>{{item.youfei}}积分</view>
</view>
</view> -->
</view>
<view class='btn_box'>
<!-- <view class='go_pay' data-d="{{item.order_odd}}" catchtap="payFun">去支付</view> -->
... ... @@ -76,8 +76,8 @@
<view class='img_right'>
<view class='info_titles'>{{zitem.product_name}}</view>
<view class='two_ones'>
<view class='scores'>积分</view>
<view class='prices'>{{zitem.product_money}}</view>
<!-- <view class='scores'>积分</view> -->
<view class='prices'>¥{{zitem.product_money}}</view>
<view class='prices' style="margin-left: 10rpx;color:#ccc;font-size: 28rpx;">X{{zitem.num}}</view>
</view>
</view>
... ... @@ -87,8 +87,8 @@
<view class='mask_two no_border'>
<view class='scorea' decode='{{true}}'>共{{item.total_num}}件商品
<text decode='{{true}}'>&emsp;实付:</text>
<text class='red_score'> {{item.total_price*100/100 + (item.youfei*100)/100}}</text>
<text class='small_red_score'>积分</text>
<text class='red_score'>¥ {{item.total_price*100/100 + (item.youfei*100)/100}}</text>
<!-- <text class='small_red_score'>积分</text> -->
</view>
</view>
... ... @@ -110,13 +110,13 @@
</view>
<view class='mask_two'>
<view>商品积分</view>
<view class='score'>{{item.total_price*100/100}}积分</view>
<view>商品价格</view>
<view class='score'>¥{{item.total_price*100/100}}</view>
</view>
<view class='mask_two no_border'>
<!-- <view class='mask_two no_border'>
<view>邮费积分</view>
<view class='score'>{{item.youfei}}积分</view>
</view>
</view> -->
<view class='btn_box'>
<view class='go_pay' data-d="{{item.order_odd}}" data-t="2" bindtap="orderagain" data-id="{{item.id}}" data-type="2" data-item="{{item.orderitem}}" data-num="{{item.total_num}}">再来一单</view>
<view class='cancel_order' data-d="{{item.order_odd}}" data-t="1" bindtap="jumpReturnFun">退货</view>
... ... @@ -146,8 +146,8 @@
<view class="address">收电话:</view> -->
<view class='two_ones'>
<view class='scores'>积分</view>
<view class='prices'>{{zitem.product_money}}</view>
<!-- <view class='scores'>积分</view> -->
<view class='prices'>¥{{zitem.product_money}}</view>
<view class='prices' style="margin-left: 10rpx;color:#ccc;font-size: 28rpx;">X{{zitem.num}}</view>
</view>
</view>
... ... @@ -172,19 +172,19 @@
</view>
<view class='mask_two'>
<view>商品积分</view>
<view class='score'>{{item.total_price*100/100}}积分</view>
<view>商品价格</view>
<view class='score'>¥{{item.total_price*100/100}}</view>
</view>
<view class='mask_two no_border'>
<!-- <view class='mask_two no_border'>
<view>邮费积分</view>
<view class='score'>{{item.youfei}}积分</view>
</view>
</view> -->
<view class='mask_two no_border'>
<view class='scorea' decode='{{true}}'>共{{item.total_num}}件商品
<text decode='{{true}}'>&emsp;实付:</text>
<text class='red_score'> {{item.total_price*100/100 + (item.youfei*100)/100}}</text>
<text class='small_red_score'>积分</text>
<text class='red_score'> ¥{{item.total_price*100/100 + (item.youfei*100)/100}}</text>
<!-- <text class='small_red_score'>积分</text> -->
</view>
</view>
<view class='btn_box'>
... ... @@ -215,8 +215,8 @@
<view class='two_ones'>
<view class='scores'>积分</view>
<view class='prices'>{{zitem.product_money}}</view>
<!-- <view class='scores'>积分</view> -->
<view class='prices'>¥{{zitem.product_money}}</view>
<view class='prices' style="margin-left: 10rpx;color:#ccc;font-size: 28rpx;">X{{zitem.num}}</view>
</view>
</view>
... ... @@ -241,19 +241,19 @@
</view>
<view class='mask_two'>
<view>商品积分</view>
<view class='score'>{{item.total_price*100/100}}积分</view>
<view>商品价格</view>
<view class='score'>¥{{item.total_price*100/100}}</view>
</view>
<view class='mask_two no_border'>
<!-- <view class='mask_two no_border'>
<view>邮费积分</view>
<view class='score'>{{item.youfei}}积分</view>
</view>
</view> -->
<view class='mask_two no_border'>
<view class='scorea' decode='{{true}}'>共{{item.total_num}}件商品
<text decode='{{true}}'>&emsp;实付:</text>
<text class='red_score'> {{item.total_price*100/100 + (item.youfei*100)/100}}</text>
<text class='small_red_score'>积分</text>
<text class='red_score'>¥ {{item.total_price*100/100 + (item.youfei*100)/100}}</text>
<!-- <text class='small_red_score'>积分</text> -->
</view>
</view>
... ... @@ -284,8 +284,8 @@
<view class='two_ones'>
<view class='scores'>积分</view>
<view class='prices'>{{zitem.product_money}}</view>
<!-- <view class='scores'>积分</view> -->
<view class='prices'>¥{{zitem.product_money}}</view>
<view class='prices' style="margin-left: 10rpx;color:#ccc;font-size: 28rpx;">X{{zitem.num}}</view>
</view>
</view>
... ... @@ -309,19 +309,19 @@
</view>
<view class='mask_two'>
<view>商品积分</view>
<view class='score'>{{item.total_price*100/100}}积分</view>
<view>商品价格</view>
<view class='score'>¥{{item.total_price*100/100}}</view>
</view>
<view class='mask_two no_border'>
<!-- <view class='mask_two no_border'>
<view>邮费积分</view>
<view class='score'>{{item.youfei}}积分</view>
</view>
</view> -->
<view class='mask_two no_border'>
<view class='scorea' decode='{{true}}'>共{{item.total_num}}件商品
<text decode='{{true}}'>&emsp;实付:</text>
<text class='red_score'> {{item.total_price*1000/1000 + (item.youfei*1000)/1000}}</text>
<text class='small_red_score'>积分</text>
<text class='red_score'>¥ {{item.total_price*1000/1000 + (item.youfei*1000)/1000}}</text>
<!-- <text class='small_red_score'>积分</text> -->
</view>
</view>
<view class='btn_box'>
... ... @@ -341,15 +341,15 @@
<!-- 待支付订单的支付弹窗 -->
<view class="cover_box" wx:if="{{cover_type}}">
<view class="cover_order">
<view class="all_money">{{totalmoney}}积分</view>
<view class="all_money">¥{{totalmoney}}</view>
<view class="money_item">
<text>商品积分</text>
<text>{{info.total_price}}积分</text>
<text>商品价格</text>
<text>¥{{info.total_price}}</text>
</view>
<view class="money_item">
<!-- <view class="money_item">
<text>邮费</text>
<text>{{info.youfei}}积分</text>
</view>
</view> -->
<view class="cover_submit" data-d="{{info.order_odd}}" catchtap="payFun">确认支付</view>
<image src="/images/close.png" class="cover_close" catchtap="show_cover" />
</view>
... ...
... ... @@ -93,12 +93,12 @@
</view>
<view class='mask_twos'>
<view class='mask_two'>
<view>退还总积分</view>
<view class='score'>{{detail.order.total_price + detail.order.youfei*100/100}}积分</view>
<view>退还总金额</view>
<view class='score'>¥{{detail.order.total_price + detail.order.youfei*100/100}}</view>
</view>
<view class='mask_two'>
<view>退回账户</view>
<view class='score'>{{detail.status == 1?detail.order.total_price + detail.order.youfei*100/100:0}}积分</view>
<view class='score'>¥{{detail.status == 1?detail.order.total_price + detail.order.youfei*100/100:0}}</view>
</view>
</view>
<!-- 退款失败结束 -->
... ... @@ -130,8 +130,8 @@
<view class='score'>{{detail.cause}}</view>
</view>
<view class='mask_two'>
<view>退款积分</view>
<view class='score'>{{detail.order.total_price + detail.order.youfei*100/100}}积分</view>
<view>退款金额</view>
<view class='score'>¥{{detail.order.total_price + detail.order.youfei*100/100}}</view>
</view>
</view>
</view>
... ...
... ... @@ -2,9 +2,9 @@
<navigator class="no_login" catchtap="go_login" url="/pages/register/register" hover-class="none">请先登录</navigator>
</block>
<block wx:elif="{{login_new==''}}">
<!-- <block wx:elif="{{login_new==''}}">
<navigator class="no_login" catchtap="go_login" url="/pages/login/login" hover-class="none">请先绑定后操作,点击绑定</navigator>
</block>
</block> -->
<block wx:else>
... ... @@ -21,7 +21,8 @@
</view>
<view class="tips_info">
<text>不含运费</text>合计
<text>{{integral}}积分</text>
<!-- 2023-10-19 需求要将积分改为微信支付的金额 -->
<text>¥{{integral}}</text>
</view>
<view class="submit" bindtap="submit">结算({{all_num}})</view>
</view>
... ...
<import src="/wxParse/wxParse.wxml" />
<view class='page{{mask?" active":""}}'>
<concat/>
<view class='top'>
<view class='current_box'>{{current+1}}/{{info.images.length}}</view>
<swiper class='swiper' current='{{current}}' bindchange='getCurrent'>
<swiper-item class='swiper-item' wx:for='{{info.images}}' wx:key='index'>
<image src='{{item}}' mode="aspectFill" />
</swiper-item>
</swiper>
</view>
<view class='two'>
<view class='two_one'>
<view class='score'>积分</view>
<view class='price'>{{info.price2==null?info.price:info.price2}}</view>
<concat />
<view class='top'>
<view class='current_box'>{{current+1}}/{{info.images.length}}</view>
<swiper class='swiper' current='{{current}}' bindchange='getCurrent'>
<swiper-item class='swiper-item' wx:for='{{info.images}}' wx:key='index'>
<image src='{{item}}' mode="aspectFill" />
</swiper-item>
</swiper>
</view>
<view class='two'>
<view class='two_one'>
<!-- 2023-10-19 需求要将积分改为微信支付的金额 -->
<!-- <view class='score'>积分</view> -->
<view class='price'>¥{{info.price2==null?info.price:info.price2}}</view>
</view>
<!-- <view class="oldprice" wx:if="{{info.price2!=null}}">{{info.price}}</view> -->
<view class='two_two'>{{info.name}}</view>
<view class='two_three two_threek'>
<view>库存:{{info.sold}}</view>
<view>销量:{{info.paynum}}</view>
</view>
</view>
<view class='three'>
<view class='three_one'>
<view class='three_one_item {{status==index?"active":""}}' wx:for='{{nav}}' wx:for-index='index' wx:key='{{index}}' bindtap='clickNav' data-index='{{index}}'>{{item}}</view>
</view>
<view class='three_two'>
<template is="wxParse" data="{{wxParseData:contenta.nodes}}" wx:if="{{status==0}}" />
<template is="wxParse" data="{{wxParseData:contenb.nodes}}" wx:elif="{{status==1}}" />
<template is="wxParse" data="{{wxParseData:contenc.nodes}}" wx:elif="{{status==2}}" />
<!-- <view class="oldprice" wx:if="{{info.price2!=null}}">{{info.price}}</view> -->
<view class='two_two'>{{info.name}}</view>
<view class='two_three two_threek'>
<view>库存:{{info.sold}}</view>
<view>销量:{{info.paynum}}</view>
</view>
</view>
<view class='three'>
<view class='three_one'>
<view class='three_one_item {{status==index?"active":""}}' wx:for='{{nav}}' wx:for-index='index' wx:key='{{index}}' bindtap='clickNav' data-index='{{index}}'>{{item}}</view>
</view>
<view class='three_two'>
<template is="wxParse" data="{{wxParseData:contenta.nodes}}" wx:if="{{status==0}}" />
<template is="wxParse" data="{{wxParseData:contenb.nodes}}" wx:elif="{{status==1}}" />
<template is="wxParse" data="{{wxParseData:contenc.nodes}}" wx:elif="{{status==2}}" />
</view>
</view>
<view class='bottom'>
<view class='cart_box' catchtap="go_car">
<view class='cart_img'>
<view class='cart_count'>{{info.shop}}</view>
<image src='/images/icon_51.png'></image>
</view>
<view class='cart_font'>购物车</view>
</view>
<view class='bottom'>
<view class='cart_box' catchtap="go_car">
<view class='cart_img'>
<view class='cart_count'>{{info.shop}}</view>
<image src='/images/icon_51.png'></image>
</view>
<view class='cart_font'>购物车</view>
</view>
<view class="sc_box" catchtap="colloct">
<image src="{{info.colloct?'/images/sc@.png':'/images/sc.png'}}" />
<view class="{{info.colloct?'active':''}}">{{info.colloct?'已收藏':'收藏'}}</view>
</view>
<view class="sc_box" catchtap="colloct">
<image src="{{info.colloct?'/images/sc@.png':'/images/sc.png'}}" />
<view class="{{info.colloct?'active':''}}">{{info.colloct?'已收藏':'收藏'}}</view>
</view>
<view class='left_btn' bindtap='change_cover' data-type="1">加入购物车</view>
<view class='right_btn' bindtap='change_cover' data-type="2">立即购买</view>
<view class='left_btn' bindtap='change_cover' data-type="1">加入购物车</view>
<view class='right_btn' bindtap='change_cover' data-type="2">立即购买</view>
<!-- 遮罩 -->
<view class="bottom_cover" catchtap="go_login" wx:if="{{no_login}}" />
</view>
<!-- 遮罩 -->
<view class="bottom_cover" catchtap="go_login" wx:if="{{no_login}}" />
</view>
</view>
<!-- 弹框开始 -->
<view class='mask' wx:if='{{mask}}' bindtap="change_cover" catchtouchmove="true">
<view class='mask_diceng'>
<view class='mask_one'>
<view class='mask_img'>
<image src='{{info.images[0]}}'></image>
</view>
<view class='img_right'>
<view class='info_title'>{{info.name}}</view>
<view wx:if="{{info.price2!=null}}">
<view class='two_ones'>
<view class='scores'>积分</view>
<view class='prices'>{{info.price2}}</view>
</view>
<!-- <view class="oldprice">{{info.price}}</view> -->
</view>
<view class='mask_diceng'>
<view class='mask_one'>
<view class='mask_img'>
<image src='{{info.images[0]}}'></image>
</view>
<view class='img_right'>
<view class='info_title'>{{info.name}}</view>
<view wx:if="{{info.price2!=null}}">
<view class='two_ones'>
<!-- 2023-10-19 需求要将积分改为微信支付的金额 -->
<!-- <view class='scores'>积分</view> -->
<view class='prices'>¥{{info.price2}}</view>
</view>
<!-- <view class="oldprice">{{info.price}}</view> -->
</view>
<view class='two_ones' wx:else>
<view class='scores'>积分</view>
<view class='prices'>{{info.price}}</view>
<view class='two_ones' wx:else>
<!-- 2023-10-19 需求要将积分改为微信支付的金额 -->
<!-- <view class='scores'>积分</view> -->
<view class='prices'>¥{{info.price}}</view>
</view>
</view>
</view>
</view>
</view>
<view class='mask_two'>
<view class='mask_two_name'>购买数量</view>
<view class='operation_box'>
<view class='operation_btn' data-type="0" catchtap="num_change">
<image src='/images/reduce.png'></image>
<view class='mask_two'>
<view class='mask_two_name'>购买数量</view>
<view class='operation_box'>
<view class='operation_btn' data-type="0" catchtap="num_change">
<image src='/images/reduce.png'></image>
</view>
<view class='operation_count'>{{num}}</view>
<view class='operation_btn' data-type="1" catchtap="num_change">
<image src='/images/add.png'></image>
</view>
</view>
</view>
<view class='operation_count'>{{num}}</view>
<view class='operation_btn' data-type="1" catchtap="num_change">
<image src='/images/add.png'></image>
<view class='mask_three'>
<view class='mask_btn1' bindtap='addshop' wx:if="{{btn_type == 1}}">加入购物车</view>
<view class='mask_btn2' bindtap='purchaseNow' wx:elif="{{btn_type == 2}}">立即购买</view>
</view>
</view>
</view>
<view class='mask_three'>
<view class='mask_btn1' bindtap='addshop' wx:if="{{btn_type == 1}}">加入购物车</view>
<view class='mask_btn2' bindtap='purchaseNow' wx:elif="{{btn_type == 2}}">立即购买</view>
</view>
</view>
</view>
<!-- 弹框结束-->
\ No newline at end of file
... ...