152 lines
2.9 KiB
JavaScript
152 lines
2.9 KiB
JavaScript
// packageA/member/supplier/SupplierInfo/SupplierInfo.js
|
|
const INDEX_URL = "plugin.supplier.frontend.shop.index.index";
|
|
const SUPPLIER_INFO_URL = "plugin.supplier.frontend.shop.index.getSupplierInfo";
|
|
var app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
show1: false,
|
|
customer_open: true,
|
|
service_QRcode: '',
|
|
service_mobile: '',
|
|
indexData: {},
|
|
supplierInfo: {},
|
|
id: '',
|
|
infoData: {}
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
if (options.id) {
|
|
this.setData({
|
|
id: options.id
|
|
});
|
|
}
|
|
this.getIndexData();
|
|
this.getSupplierInfo();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
callPhone() {
|
|
wx.makePhoneCall({
|
|
phoneNumber: this.data.service_mobile,
|
|
});
|
|
},
|
|
showPop() {
|
|
console.log("点击");
|
|
if (this.data.customer_open) {
|
|
this.setData({
|
|
show1: true
|
|
});
|
|
}
|
|
},
|
|
closePop() {
|
|
this.setData({
|
|
show1: false
|
|
});
|
|
},
|
|
//首页
|
|
getIndexData() {
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss(INDEX_URL);
|
|
urlStr += '&sid=' + this.data.id;
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: function (resdata) {
|
|
var res = resdata.data;
|
|
if (res.result != 1) return;
|
|
that.setData({
|
|
indexData: res.data,
|
|
supplierInfo: res.data.supplier,
|
|
customer_open: res.data.customer_open == '1' ? true : false,
|
|
service_QRcode: res.data.service_QRcode,
|
|
service_mobile: res.data.service_mobile,
|
|
});
|
|
},
|
|
fail: function (res) {
|
|
console.log(res.msg);
|
|
}
|
|
});
|
|
},
|
|
getSupplierInfo() {
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss(SUPPLIER_INFO_URL);
|
|
urlStr += '&sid=' + this.data.id;
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: function (resdata) {
|
|
var res = resdata.data;
|
|
if (res.result != 1) return;
|
|
that.setData({
|
|
infoData: res.data
|
|
});
|
|
},
|
|
fail: function (res) {
|
|
console.log(res.msg);
|
|
}
|
|
});
|
|
},
|
|
goToSupplierShop() {
|
|
let pages = getCurrentPages();
|
|
if (pages.length > 1) {
|
|
wx.navigateBack();
|
|
} else {
|
|
wx.navigateTo({
|
|
url: "/packageA/member/supplier/SupplierShop/SupplierShop?id=" + this.data.id
|
|
});
|
|
}
|
|
|
|
}
|
|
}); |