diff --git a/app.js b/app.js index 6874b02..14dbbbb 100644 --- a/app.js +++ b/app.js @@ -10,6 +10,7 @@ App({ }); }, + globalData: { customerArray:[], goodsNameArray:[], diff --git a/app.json b/app.json index d680ef2..cdc0727 100644 --- a/app.json +++ b/app.json @@ -24,7 +24,9 @@ "pages/outStore/outStore", "pages/outStore/outStoreDetail/outStoreDetail", "pages/specialOrderApplication/specialOrderApplyDetail/specialOrderApplyDetail", - "pages/outStore/query/query" + "pages/outStore/query/query", + "pages/startImage/startImage" + ], "window": { "backgroundTextStyle": "light", diff --git a/imgs/bindImage.png b/imgs/bindImage.png index 9a64563..ae5447a 100644 Binary files a/imgs/bindImage.png and b/imgs/bindImage.png differ diff --git a/pages/customerChooseTemplate/customerChooseTemplate.js b/pages/customerChooseTemplate/customerChooseTemplate.js index 601f3f7..1b893d9 100644 --- a/pages/customerChooseTemplate/customerChooseTemplate.js +++ b/pages/customerChooseTemplate/customerChooseTemplate.js @@ -7,7 +7,7 @@ var utilll = require('../../utils/util.js'); var fromPage = ''; var getAccountingUnit = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetAccountingUnit"; -var getCustomer = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetCustomerExt"; +var getCustomer = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetCustomer"; Page({ @@ -31,7 +31,7 @@ Page({ "InputValue": inputValue, "PageIndex": 0, "PageSize": 100 - }, ["CustomerCatalog_Name"]]; + }];//, ["CustomerCatalog_Name"] network.transfer_request(method, params, function(res) { that.setData({ customerArray: res.result diff --git a/pages/order/newBill/newBill.js b/pages/order/newBill/newBill.js index b753178..94759c9 100644 --- a/pages/order/newBill/newBill.js +++ b/pages/order/newBill/newBill.js @@ -288,14 +288,10 @@ Page({ this.util(); }, - getGoodsNum: function (e) { - var v = e.detail.value; - let end = v.charAt(v.length - 1) - if (end == ".") - return; + getGoodsNum: function(e) { let idx = e.target.dataset.idx; var detail = this.data.dmo.Details[idx]; - let value = Number(v); + let value = Number(e.detail.value); if (isNaN(value)) { wx.showModal({ title: '提示', @@ -314,14 +310,10 @@ Page({ }) }, - getSecondNum: function (e) { - var v = e.detail.value; - let end = v.charAt(v.length - 1) - if (end == ".") - return; + getSecondNum: function(e) { let idx = e.target.dataset.idx; var detail = this.data.dmo.Details[idx]; - let value = Number(v); + let value = Number(e.detail.value); if (isNaN(value)) { wx.showModal({ title: '提示', @@ -341,13 +333,9 @@ Page({ }, // - getPrice: function (e) { - var v = e.detail.value; - let end = v.charAt(v.length - 1) - if (end == ".") - return; + getPrice: function(e) { let idx = e.target.dataset.idx; - let value = Number(v); + let value = Number(e.detail.value); if (isNaN(value)) { wx.showToast({ title: '提示', @@ -428,7 +416,14 @@ Page({ }) return; } - + + if (dmo.DeliverAddress == "") { + wx.showToast({ + title: '请填写送货地址', + }) + return; + } + for (var i = 0; i < dmo.Details.length; i++) { if (dmo.Details[i].SaleGoods_ID == null) { wx.showToast({ diff --git a/pages/saleForecastList/newBill/newBill.js b/pages/saleForecastList/newBill/newBill.js index 5a2e627..1811462 100644 --- a/pages/saleForecastList/newBill/newBill.js +++ b/pages/saleForecastList/newBill/newBill.js @@ -432,7 +432,6 @@ Page({ network.transfer_request(method, params, function (res) { if (res.result != null) { - wx.showModal({ title: '新建预报No.' + res.result, content: '新建成功,是否返回首页', @@ -447,6 +446,5 @@ Page({ }) } }) - }, }) \ No newline at end of file diff --git a/pages/startImage/startImage.js b/pages/startImage/startImage.js new file mode 100644 index 0000000..4a14d7e --- /dev/null +++ b/pages/startImage/startImage.js @@ -0,0 +1,106 @@ +// pages/startImage/startImage.js +var app = getApp(); +var network = require("../../utils/net.js"); +var getOpenIdByCode = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/GetMiniOpenIdByCode'; +var getBindCustomer = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/GetBindCustomer'; +var getCookie = '/MainSystem/MainSystem/Auth/WeixinLogin'; +var isBindedPath = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/AccountRpc/IsBinded'; +var isBindWeixinPath = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/IsBindWeixinMP'; + +Page({ + + data: { + + }, + + onShow: function() { + var that = this; + + wx.login({ + success: function(res) { + let code = res.code; + let method = getOpenIdByCode; + let params = [app.globalData.appID, code]; + // 获取openID + network.requestLoading(method, params, function(res) { + app.globalData.openID = res.result; + // 获取绑定客户ID及用户电话 + that.GetBindCustomer(); + }) + } + }); + + }, + + /** + * 获取绑定客户ID及用户电话 参数1、appID 2、openID + * 返回值globalCustomerID,WeixinUser_Phone + * 成功调用获取cookie方法及判断是否绑定成功方法 + */ + GetBindCustomer: function() { + var that = this; + let method = getBindCustomer; + let params = [app.globalData.appID, app.globalData.openID]; + network.requestLoading(method, params, function(res) { + if (res.result != null) { + app.globalData.globalCustomerID = res.result.ID; + app.globalData.phoneNum = res.result.WeixinUser_Phone; + // 获取cookie值 + that.WeixinLogin(function(res) { + // 判断是否绑定成功 参数openid 返回值phoneNum + that.IsBinded(app.globalData.openID); + }); + } + }) + }, + + // 获取cookie值 参数1、appID 2、openID + WeixinLogin: function(successtion) { + var that = this; + let method = getCookie; + let params = [app.globalData.appID, app.globalData.openID]; + network.transfer_request(method, params, function(res) { + app.globalData.cookie = res.result; + successtion(); + }) + }, + + + /** + * 判断是否绑定成功 参数openid + * 返回值phoneNum + * 成功调用是否关注公众号方法 + */ + IsBinded: function(openid) { + var that = this; + let method = isBindedPath; + let params = [openid]; + network.transfer_request(method, params, function(res) { + if (res.result != "") { + app.globalData.phoneNum = res.result; + // 判断是否关注公众号 + that.IsBindWeixinMP(app.globalData.phoneNum) + } + }) + }, + // 判断是否关注公众号 参数phone 返回值bool 成功进入首页 + IsBindWeixinMP: function(phone) { + let method = isBindWeixinPath; + let params = [phone]; + network.requestLoading(method, params, function(res) { + // res.result = false; + if (res.result == true) { + wx.switchTab({ + url: '/pages/homePage/homePage', + }) + } else { + wx.showModal({ + title: '提示', + content: '请关注公众号', + showCancel: false, + }) + } + }) + }, + +}) \ No newline at end of file diff --git a/pages/startImage/startImage.json b/pages/startImage/startImage.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/pages/startImage/startImage.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/pages/startImage/startImage.wxml b/pages/startImage/startImage.wxml new file mode 100644 index 0000000..bc4cfff --- /dev/null +++ b/pages/startImage/startImage.wxml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/pages/startImage/startImage.wxss b/pages/startImage/startImage.wxss new file mode 100644 index 0000000..4b29424 --- /dev/null +++ b/pages/startImage/startImage.wxss @@ -0,0 +1,11 @@ +/* pages/startImage/startImage.wxss */ +page{ + width: 100%; + height: 100%; +} + +.container{ + width: 100%; + height: 100%; + background-color: blue; +} \ No newline at end of file