Commit f6b072a4 by 梁建民

Merge branch 'master' of http://119.23.72.7/shiyu/icsalesProgram

parents 9a2ea822 c89b5be7
......@@ -17,11 +17,11 @@ App({
isIPX: false, //是否为iphone X
customerNum: "001",
customerName: "IC助手客服",
isRelogin:true,//登入环信失败后是否重新登入,只允许重新登入一次
bus:bus
isRelogin: true, //登入环信失败后是否重新登入,只允许重新登入一次
bus: bus
},
getImUser: chat.getImUser,
addChatMember: function (id,userId) {//id为环信id userId为账户id
addChatMember: function(id, userId) { //id为环信id userId为账户id
let token = wx.getStorageSync('access_token') || '';
this.addChatMemberStorage(id);
......@@ -29,7 +29,7 @@ App({
getData(apis.addrecord, 'GET', {
"token": token,
"user_id": userId
}, function (res) {
}, function(res) {
if (res.errcode === 0) {
} else {
......@@ -37,7 +37,7 @@ App({
}
}, false);
},
addChatMemberStorage: function (id) {
addChatMemberStorage: function(id) {
let member = wx.getStorageSync("member") || [];
member.push(id);
wx.setStorage({
......@@ -47,6 +47,7 @@ App({
},
onLaunch() {
wx.removeStorageSync('im');
this.versionUpdate();
//验证是否授权
if (this.globalData.auth) {
//是否登录
......@@ -73,10 +74,41 @@ App({
chat.webimListen();
this.checkIsIPhoneX();
},
checkIsIPhoneX: function () {
versionUpdate: function() {//小程序检测版本更新
if (wx.canIUse('getUpdateManager')) {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function(res) {
if (res.hasUpdate) {
updateManager.onUpdateReady(function() {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function(res) {
if (res.confirm) {
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function() {
wx.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
})
})
}
})
} else {
wx.showModal({
title: '提示',
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
})
}
},
checkIsIPhoneX: function() {
const me = this
wx.getSystemInfo({
success: function (res) {
success: function(res) {
// 根据 model 进行判断
if (res.model.search('iPhone X') != -1) {
me.globalData.isIPX = true
......
......@@ -16,34 +16,29 @@ Page({
info: null,
editOrShow: -1, //1编辑 2在线沟通
goodId: "",
type: "",
isShowImg: false,
type: ""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
let me = this;
this.setData({
goodId: options.goodId || '',
type: options.type || ''
});
this.getData(false)
getApp().globalData.bus.off('editGood');
getApp().globalData.bus.on('editGood', () => {
me.getData(true)
})
console.log(options)
},
getData: function() {
getData: function(bool) {
let me = this;
let token = wx.getStorageSync('access_token');
let url = "";
let goodId = me.data.goodId;
let type = me.data.type;
// if (type == 1) {
// url = apis.goodsInfo;
// } else if (type == 2 || type == 3) {
// url = apis.goodsSearch;
// } else {
// return;
// }
getData(apis.goodsSearch, 'get', {
"goods_id/eq": goodId,
"token": token,
......@@ -59,12 +54,18 @@ Page({
if (type == 1) {
me.setData({
editOrShow: 1
})
});
if (bool) {
getApp().globalData.bus.emit('editGoodSuccess', res.goods_list[goodId]);
}
} else if (type == 2 || type == 3) {
if (userId == targetId) {
me.setData({
editOrShow: 1
})
});
if (bool) {
getApp().globalData.bus.emit('editGoodSuccess', res.goods_list[goodId]);
}
} else {
me.setData({
editOrShow: 2
......@@ -142,13 +143,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function() {
if (this.data.isShowImg) {
this.setData({
isShowImg: false
})
} else {
this.getData()
}
},
/**
......@@ -193,9 +188,6 @@ Page({
previewImage: function() {
let img = this.data.info.goods_images;
if (img) {
this.setData({
isShowImg: true
})
wx.previewImage({
urls: [img]
})
......
......@@ -92,7 +92,11 @@ Page({
isClick: true
});
setTimeout(() => {
wx.navigateBack()
wx.navigateBack();
getApp().globalData.bus.emit('addBj');
if (me.data.type == 1){
getApp().globalData.bus.emit('addFirstBj', me.data.inquiryItemsId);
}
}, 1000)
} else {
......
......@@ -49,8 +49,7 @@ Page({
wx.setNavigationBarTitle({
title: '新增商品'
})
}
};
},
getGoodData: function() {
let me = this;
......
......@@ -25,6 +25,7 @@ Page({
onLoad: function(options) {
let me = this;
this.getData();
getApp().globalData.bus.off('addXj');
getApp().globalData.bus.on('addXj', () => {
me.setData({
priceList: null,
......@@ -33,6 +34,18 @@ Page({
isShowBottom: false,
});
me.getData();
});
getApp().globalData.bus.off('addFirstBj');
getApp().globalData.bus.on('addFirstBj', (id) => {
let index = me.data.priceList.findIndex((value, index, arr) => {
return value.inquiry_items_id == id
});
if (index !== -1) {
me.data.priceList[index].offer_num+=1;
me.setData({
priceList: me.data.priceList
})
}
})
},
getData: function() {
......
......@@ -21,7 +21,7 @@ Page({
type: 0, //1 看别人的询价 2给别人报价 3分享进来的
inquiryItemsId: "",
offerId: "",
isShowImg: false,
// isShowImg: false,
isShareType: 0, //分享后点进来的页面 1代表自己的询价 2代表别人的询价
},
......@@ -29,16 +29,26 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
let me = this;
this.setData({
inquiryItemsId: options.inquiryItemsId || '',
type: options.type || '',
offerId: options.offerId || ''
});
console.log(options)
this.getTopInfo();
if (this.data.type == 1) {
this.getOthertBj();
} else if (this.data.type == 2) {
this.getSelfBj();
}
getApp().globalData.bus.off('addBj');
getApp().globalData.bus.on('addBj', function() {
me.setData({
priceList: null,
total: 0,
});
me.getSelfBj();
});
},
getTopInfo: function() {
let me = this;
......@@ -156,19 +166,19 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function() {
if (this.data.type == 2 || this.data.isShareType == 2) {
if (this.data.isShowImg) {
this.setData({
isShowImg: false
})
} else {
this.setData({
priceList: null,
total: 0,
});
this.getSelfBj()
}
}
// if (this.data.type == 2 || this.data.isShareType == 2) {
// if (this.data.isShowImg) {
// this.setData({
// isShowImg: false
// })
// } else {
// this.setData({
// priceList: null,
// total: 0,
// });
// this.getSelfBj()
// }
// }
},
......@@ -249,11 +259,11 @@ Page({
previewImage: function() {
let img = this.data.topInfo.goods_images;
if (img) {
if (this.data.type == 2) {
this.setData({
isShowImg: true
})
}
// if (this.data.type == 2) {
// this.setData({
// isShowImg: true
// })
// }
wx.previewImage({
urls: [img]
})
......
......@@ -30,6 +30,7 @@ Page({
onLoad: function(options) {
let key = options.key;
let me = this;
this.setData({
key: key,
confirmKey: key,
......@@ -37,6 +38,7 @@ Page({
});
this.storageKey(key)
this.getData();
getApp().globalData.bus.off('addXj');
getApp().globalData.bus.on('addXj', () => {
if (me.data.tabIndex == 2) {
me.setData({
......@@ -48,6 +50,7 @@ Page({
me.getData();
}
});
getApp().globalData.bus.off('addGood');
getApp().globalData.bus.on('addGood', () => {
if (me.data.tabIndex == 1) {
me.setData({
......@@ -58,10 +61,29 @@ Page({
});
me.getData();
}
});
getApp().globalData.bus.off('editGoodSuccess');
getApp().globalData.bus.on('editGoodSuccess', (params) => {
let index = me.data.priceList.findIndex((value, index, arr) => {
return value.goods_id == params.goods_id
});
if (index !== -1) {
me.data.priceList[index] = params;
me.setData({
priceList: me.data.priceList
})
}
});
getApp().globalData.bus.off('addFirstBj');
getApp().globalData.bus.on('addFirstBj', (id) => {
let index = me.data.priceList.findIndex((value, index, arr) => {
return value.inquiry_items_id == id
});
if (index !== -1) {
me.data.priceList[index].offer_num += 1;
me.setData({
priceList: me.data.priceList
})
getApp().globalData.bus.on('editGood', () => {
if (me.data.tabIndex == 1) {
console.log('编辑商品')
}
})
},
......
// pages/tab/good/good.js
import { getData, judgeToken } from '../../../utils/util.js';
import { apis } from '../../../utils/api.js';
import {
getData,
judgeToken
} from '../../../utils/util.js';
import {
apis
} from '../../../utils/api.js';
Page({
/**
* 页面的初始数据
*/
data: {
priceList: null,//商品数据
limit: 10,//每页的条数
p: 1,//当前页面
priceList: null, //商品数据
limit: 10, //每页的条数
p: 1, //当前页面
total: 0,
time: "",
key: "",
confirmKey: "",
isShowBottom:false,
isFixed:false,
isShowBottom: false,
isFixed: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad: function(options) {
let me = this;
if (judgeToken(true)) {
this.getData();
......@@ -34,17 +39,25 @@ Page({
isShowBottom: false,
});
me.getData();
});
getApp().globalData.bus.on('editGoodSuccess', (params) => {
let index = me.data.priceList.findIndex((value, index, arr) => {
return value.goods_id == params.goods_id
});
if (index !== -1) {
me.data.priceList[index] = params;
me.setData({
priceList: me.data.priceList
})
getApp().globalData.bus.on('editGood', () => {
console.log('编辑商品')
}
})
},
bindKeyInput: function (e) {
bindKeyInput: function(e) {
this.setData({
key: e.detail.value
})
},
bindKeyConfirm: function () {
bindKeyConfirm: function() {
let key = this.data.key;
this.setData({
confirmKey: key,
......@@ -52,17 +65,20 @@ Page({
p: 1,
total: 0,
time: "",
isShowBottom:false
isShowBottom: false
});
this.getData();
},
getData: function (isRefresh) {
getData: function(isRefresh) {
let me = this;
let token = wx.getStorageSync('access_token')
getData(apis.goodsInfo,'get', {
offset: me.data.limit, p: me.data.p, token: token, 'goods_name/like': me.data.confirmKey
}, function (res) {
getData(apis.goodsInfo, 'get', {
offset: me.data.limit,
p: me.data.p,
token: token,
'goods_name/like': me.data.confirmKey
}, function(res) {
if (res.errcode === 0) {
let newArr = [];
if (me.data.p > 1) {
......@@ -80,7 +96,7 @@ Page({
priceList: newArr,
total: res.total,
});
if (isRefresh){
if (isRefresh) {
wx.stopPullDownRefresh()
}
} else if (res.errcode === 110001 || res.errcode === 103001) {
......@@ -94,21 +110,21 @@ Page({
}
}
}, isRefresh?false:true)
}, isRefresh ? false : true)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
onReady: function() {
},
onPageScroll:function(e){
if(e.scrollTop>90){
onPageScroll: function(e) {
if (e.scrollTop > 90) {
this.setData({
isFixed:true
isFixed: true
})
}else{
} else {
this.setData({
isFixed: false
})
......@@ -117,28 +133,28 @@ Page({
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
onPullDownRefresh: function() {
this.setData({
p: 1,
isShowBottom: false
......@@ -149,12 +165,12 @@ Page({
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
onReachBottom: function() {
let allPage = Math.ceil(this.data.total / this.data.limit);
let p = this.data.p;
if (p == allPage) {
this.setData({
isShowBottom:true
isShowBottom: true
});
return
} else {
......@@ -164,7 +180,7 @@ Page({
this.getData();
}
},
fbGood: function () {
fbGood: function() {
wx.navigateTo({
url: "/pages/form/good/index",
})
......
......@@ -27,7 +27,7 @@ Page({
onLoad: function (options) {
let me = this;
wx.removeStorageSync('homeToken')
this.getData(false);
this.getData();
if (!judgeToken()) {
wx.setStorageSync('homeToken', 1)
};
......@@ -66,7 +66,6 @@ Page({
me.setData({
xjList: newArr
});
if (newArr.length == 1) {
me.setData({
multiple: 1
......@@ -83,9 +82,9 @@ Page({
})
}
}, true)
}, false)
},
getData: function (bool) {
getData: function () {
let me = this;
let url, token = wx.getStorageSync('access_token')
if (!token) {
......@@ -121,7 +120,7 @@ Page({
priceList: []
})
}
}, bool)
}, true)
}
},
/**
......@@ -138,7 +137,7 @@ Page({
this.getTopData();
if (judgeToken()) {
if (wx.getStorageSync('homeToken')) {
this.getData(false);
this.getData();
wx.removeStorageSync('homeToken')
}
......
......@@ -23,7 +23,7 @@ Page({
let me = this;
if (judgeToken(true)) {
this.getData();
}
};
getApp().globalData.bus.on('addXj', () => {
if (me.data.tabIndex == 1) {
me.setData({
......
......@@ -52,236 +52,12 @@
"list": []
},
"miniprogram": {
"current": 32,
"current": 0,
"list": [
{
"id": -1,
"name": "pages/form/xj/index",
"pathName": "pages/form/xj/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/setting/index",
"pathName": "pages/person/setting/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/setpassword/index",
"pathName": "pages/person/setpassword/index",
"query": "",
"scene": null
},
{
"id": 10,
"name": "pages/person/certification/addcertification/index",
"pathName": "pages/person/certification/addcertification/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/certification/certificationmanage/index",
"pathName": "pages/person/certification/certificationmanage/index",
"query": "",
"scene": null
},
{
"id": 5,
"name": "pages/form/bj/index",
"pathName": "pages/form/bj/index",
"query": "type=2&offerId=156386287503289",
"scene": null
},
{
"id": 6,
"name": "pages/form/good/index",
"pathName": "pages/form/good/index",
"query": "goodId=156454347576866",
"scene": null
},
{
"id": 7,
"name": "pages/detail/chat/index",
"pathName": "pages/detail/chat/index",
"query": "username={\"myName\":\"7a2765fc7caa5e512a6d1270bcf98bf0\",\"your\":\"06b6a13c7ae849be08c98ceeefd6ee7f\",\"name\":\"sy\",\"name1\":\"11\",\"id\":\"53\",\"touserid\":\"54\",\"title\":\"11\",\"img\":\"http://img.icsales.com/test/images/icsales/201907/18/ee8b86dc8cac0e5df402a72d77a1b75e.png\",\"img1\":\"http://img.icsales.com/test/images/icsales/201907/18/767111a5b24e07d950506ea9452ff57c.jpg\"}",
"scene": null
},
{
"id": -1,
"name": "pages/tab/me/me",
"pathName": "pages/tab/me/me",
"query": "",
"scene": null
},
{
"id": 9,
"name": "pages/person/exchange/index",
"pathName": "pages/person/exchange/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/withdrawal/index",
"pathName": "pages/person/withdrawal/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/withdrawalsuccess/index",
"pathName": "pages/person/withdrawalsuccess/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/welfare/index",
"pathName": "pages/person/welfare/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/integralrule/index",
"pathName": "pages/person/integralrule/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/packet/index",
"pathName": "pages/person/packet/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/invitation/index",
"pathName": "pages/person/invitation/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/invitationrecord/index",
"pathName": "pages/person/invitationrecord/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/list/signin/index",
"pathName": "pages/list/signin/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/form/report/index",
"pathName": "pages/form/report/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/login/index",
"pathName": "pages/person/login/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/register/index",
"pathName": "pages/person/register/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/company/index",
"pathName": "pages/person/company/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/editcompany/index",
"pathName": "pages/person/editcompany/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/auth/index",
"pathName": "pages/person/auth/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/list/notice/index",
"pathName": "pages/list/notice/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/tab/home/home",
"pathName": "pages/tab/home/home",
"query": "",
"scene": null
},
{
"id": 26,
"name": "pages/detail/good/index",
"pathName": "pages/detail/good/index",
"query": "goodId=156274103196309&type=3",
"scene": null
},
{
"id": 27,
"name": "pages/list/xj/index",
"pathName": "pages/list/xj/index",
"query": "inquiryItemsId=156403573054791&type=3",
"scene": null
},
{
"id": -1,
"name": "pages/detail/good/index",
"pathName": "pages/detail/good/index",
"query": "goodId=156617742470181&type=3",
"scene": null
},
{
"id": -1,
"name": "pages/detail/good/index",
"pathName": "pages/detail/good/index",
"query": "goodId=156393707673258&type=3",
"scene": null
},
{
"id": -1,
"name": "pages/tab/home/home",
"name": "版本更新",
"pathName": "pages/tab/home/home",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/list/rate/index",
"pathName": "pages/list/rate/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/list/ratemanage/index",
"pathName": "pages/list/ratemanage/index",
"scene": null
}
]
......
// const auth_url = 'https://authapi.icsales.com';
// const so_url = 'https://soapi.icsales.com';
// const offer_url = "https://offerapi.icsales.com";
// const user_url = 'https://userapi.icsales.com';
// const goods_url = 'https://goodsapi.icsales.com';
// const home_url = 'https://home.icsales.com';
const auth_url = 'http://authapi.icsales.cc';
const so_url = 'http://soapi.icsales.cc';
const offer_url = "http://offerapi.icsales.cc";
const user_url = 'http://userapi.icsales.cc';
const goods_url = 'http://goodsapi.icsales.cc';
const home_url = 'http://home.icsales.cc';
const auth_url = 'https://authapi.icsales.com';
const so_url = 'https://soapi.icsales.com';
const offer_url = "https://offerapi.icsales.com";
const user_url = 'https://userapi.icsales.com';
const goods_url = 'https://goodsapi.icsales.com';
const home_url = 'https://home.icsales.com';
// const auth_url = 'http://authapi.icsales.cc';
// const so_url = 'http://soapi.icsales.cc';
// const offer_url = "http://offerapi.icsales.cc";
// const user_url = 'http://userapi.icsales.cc';
// const goods_url = 'http://goodsapi.icsales.cc';
// const home_url = 'http://home.icsales.cc';
const apis = {
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment