|
|
@@ -20,145 +20,229 @@ var qqmapsdk;
|
|
|
* 小程序地图调用
|
|
|
*/
|
|
|
function onClickWxchartAddress() {
|
|
|
- const key = config.key; //使用在腾讯位置服务申请的key
|
|
|
- const referer = 'wx76a9a06e5b4e693e'; //调用插件的app的名称
|
|
|
- const category = '小区';
|
|
|
- wx.navigateTo({
|
|
|
- url: 'plugin://chooseLocation/index?key=' + key + '&referer=' + referer + '&category=' + category
|
|
|
- });
|
|
|
+ const key = config.key; //使用在腾讯位置服务申请的key
|
|
|
+ const referer = 'wx76a9a06e5b4e693e'; //调用插件的app的名称
|
|
|
+ const category = '小区';
|
|
|
+ wx.navigateTo({
|
|
|
+ url: 'plugin://chooseLocation/index?key=' + key + '&referer=' + referer + '&category=' + category
|
|
|
+ });
|
|
|
}
|
|
|
/**
|
|
|
* 判断是否有按钮权限
|
|
|
* @param {*} functionCode
|
|
|
*/
|
|
|
function hasRight(functionCode) {
|
|
|
- let rights = app.globalData.user.rights
|
|
|
- let value = false
|
|
|
- if (rights != null && rights.length > 0) {
|
|
|
- rights.forEach(item => {
|
|
|
- if (item.FunctionCode == functionCode) {
|
|
|
- value = true
|
|
|
- return
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- return value
|
|
|
-}
|
|
|
-/**
|
|
|
- * @desc : 前台实现千分位
|
|
|
- * @date : 2022/6/30 16:49
|
|
|
- * @author : 周兴
|
|
|
- */
|
|
|
-function toThousandCents(num) {
|
|
|
- if (num == undefined) {
|
|
|
- return 0;
|
|
|
- }
|
|
|
- var num = num + '';
|
|
|
- var d = '';
|
|
|
- if (num.slice(0, 1) == '-') {
|
|
|
- d = num.slice(0, 1);
|
|
|
- num = num.slice(1);
|
|
|
- }
|
|
|
- var len = num.length;
|
|
|
- var index = num.indexOf('.');
|
|
|
- if (index == -1) {
|
|
|
- num = num + '.00';
|
|
|
- } else if ((index + 2) == len) {
|
|
|
- num = num + '0';
|
|
|
- }
|
|
|
- var index = num.indexOf('.'); // 字符出现的位置
|
|
|
- var num2 = num.slice(-3);
|
|
|
- num = num.slice(0, index)
|
|
|
- var result = '';
|
|
|
- while (num.length > 3) {
|
|
|
- result = ',' + num.slice(-3) + result;
|
|
|
- num = num.slice(0, num.length - 3);
|
|
|
- }
|
|
|
- if (num) {
|
|
|
- result = num + result;
|
|
|
- }
|
|
|
- return d + (result + num2)
|
|
|
+ let rights = app.globalData.user.rights
|
|
|
+ let value = false
|
|
|
+ if (rights != null && rights.length > 0) {
|
|
|
+ rights.forEach(item => {
|
|
|
+ if (item.FunctionCode == functionCode) {
|
|
|
+ value = true
|
|
|
+ return
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return value
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 跳转到固定节点的位置
|
|
|
* @param {*} selectid
|
|
|
* @param {*} minus
|
|
|
*/
|
|
|
function navigatePosition(selectid, minus) {
|
|
|
- //1、返回一个查询实例
|
|
|
- const query = wx.createSelectorQuery();
|
|
|
- //2、选择要跳转的节点id
|
|
|
- query.select('#' + selectid).boundingClientRect();
|
|
|
- //3、获取显示区域的尺寸、滚动等位置等信息,然后添加节点的滚动位置查询
|
|
|
- query.selectViewport().scrollOffset();
|
|
|
- //4、执行跳转
|
|
|
- query.exec((res) => {
|
|
|
- //5、res[0]是步骤2中的数据,res[1]是步骤3中的数据
|
|
|
- if (res[0] && res[1]) {
|
|
|
- //6、将页面滚动到目标位置 减300不是固定的 根据自己的要求调
|
|
|
- wx.pageScrollTo({
|
|
|
- //7、计算滚动到目标的位置
|
|
|
- scrollTop: res[0].top + res[1].scrollTop - minus,
|
|
|
- duration: 300
|
|
|
- })
|
|
|
+ //1、返回一个查询实例
|
|
|
+ const query = wx.createSelectorQuery();
|
|
|
+ //2、选择要跳转的节点id
|
|
|
+ query.select('#' + selectid).boundingClientRect();
|
|
|
+ //3、获取显示区域的尺寸、滚动等位置等信息,然后添加节点的滚动位置查询
|
|
|
+ query.selectViewport().scrollOffset();
|
|
|
+ //4、执行跳转
|
|
|
+ query.exec((res) => {
|
|
|
+ //5、res[0]是步骤2中的数据,res[1]是步骤3中的数据
|
|
|
+ if (res[0] && res[1]) {
|
|
|
+ //6、将页面滚动到目标位置 减300不是固定的 根据自己的要求调
|
|
|
+ wx.pageScrollTo({
|
|
|
+ //7、计算滚动到目标的位置
|
|
|
+ scrollTop: res[0].top + res[1].scrollTop - minus,
|
|
|
+ duration: 300
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @desc : 前台实现千分位
|
|
|
+ * @date : 2022/6/30 16:49
|
|
|
+ * @author : 周兴
|
|
|
+ */
|
|
|
+function toThousandCents(num) {
|
|
|
+ if (num == undefined) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ var num = num + '';
|
|
|
+ var d = '';
|
|
|
+ if (num.slice(0, 1) == '-') {
|
|
|
+ d = num.slice(0, 1);
|
|
|
+ num = num.slice(1);
|
|
|
+ }
|
|
|
+ var len = num.length;
|
|
|
+ var index = num.indexOf('.');
|
|
|
+ if (index == -1) {
|
|
|
+ num = num + '.00';
|
|
|
+ } else if ((index + 2) == len) {
|
|
|
+ num = num + '0';
|
|
|
+ }
|
|
|
+ var index = num.indexOf('.'); // 字符出现的位置
|
|
|
+ var num2 = num.slice(-3);
|
|
|
+ num = num.slice(0, index)
|
|
|
+ var result = '';
|
|
|
+ while (num.length > 3) {
|
|
|
+ result = ',' + num.slice(-3) + result;
|
|
|
+ num = num.slice(0, num.length - 3);
|
|
|
+ }
|
|
|
+ if (num) {
|
|
|
+ result = num + result;
|
|
|
}
|
|
|
- });
|
|
|
+ return d + (result + num2)
|
|
|
}
|
|
|
-
|
|
|
|
|
|
/**
|
|
|
* 导航
|
|
|
*/
|
|
|
function navigate(address) {
|
|
|
- qqmapsdk.geocoder({
|
|
|
- //获取表单传入地址
|
|
|
- address: address,
|
|
|
- //地址参数,例:固定地址,address: '北京市海淀区彩和坊路海淀西大街74号'
|
|
|
- success: function (res) {//成功后的回调
|
|
|
- var res = res.result;
|
|
|
- var latitude = res.location.lat;
|
|
|
- var longitude = res.location.lng;
|
|
|
-
|
|
|
- wx.openLocation({
|
|
|
- latitude,
|
|
|
- longitude,
|
|
|
- scale: 18
|
|
|
- })
|
|
|
- },
|
|
|
- fail: function (error) {
|
|
|
- wx.showToast({
|
|
|
- title: '地址无法导航',
|
|
|
- image: '/static/image/warning.png',
|
|
|
- duration: 1000
|
|
|
- })
|
|
|
- },
|
|
|
- complete: function (res) {
|
|
|
+
|
|
|
+ qqmapsdk.geocoder({
|
|
|
+ //获取表单传入地址
|
|
|
+ address: address,
|
|
|
+ //地址参数,例:固定地址,address: '北京市海淀区彩和坊路海淀西大街74号'
|
|
|
+ success: function (res) {//成功后的回调
|
|
|
+ var res = res.result;
|
|
|
+ var latitude = res.location.lat;
|
|
|
+ var longitude = res.location.lng;
|
|
|
+
|
|
|
+ wx.openLocation({
|
|
|
+ latitude,
|
|
|
+ longitude,
|
|
|
+ scale: 18
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail: function (error) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '地址无法导航',
|
|
|
+ image: '/static/image/warning.png',
|
|
|
+ duration: 1000
|
|
|
+ })
|
|
|
+ },
|
|
|
+ complete: function (res) {
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* @desc : 设置图片路径
|
|
|
+* @date : 2022/7/5 16:49
|
|
|
+* @author : 周兴
|
|
|
+*/
|
|
|
+function setSkuIcon(skuData) {
|
|
|
+ if (skuData && skuData.length > 0) {
|
|
|
+ let imagePath = config.server_img_http;
|
|
|
+ let imageHgPath = config.server_hg_img_http;
|
|
|
+ if (skuData != null && skuData.length > 0) {
|
|
|
+ skuData.forEach(it => {
|
|
|
+ if (it.pathType === 1) { //业务中台 2 本系统 1 2 需要加密
|
|
|
+ // 对行数据进行图标路径的处理
|
|
|
+ setImagePath(it, imagePath, imageHgPath);
|
|
|
+ // 如果有子级,需要对子级进行处理
|
|
|
+ if (it.goodsSkuList != null && it.goodsSkuList.length > 0) {
|
|
|
+ it.goodsSkuList.forEach(row => {
|
|
|
+ // 对子数据行数据进行图标路径的处理
|
|
|
+ setImagePath(row, imagePath, imageHgPath);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+/**
|
|
|
+* @desc : 设置行的图标路径
|
|
|
+* @date : 2022/7/5 16:49
|
|
|
+* @author : 周兴
|
|
|
+*/
|
|
|
+function setImagePath(it, imagePath, imageHgPath) {
|
|
|
+ // 根据图标来源设置绝对路径
|
|
|
+ if (it.pathType == Constants.PATH_TYPE.HG) {
|
|
|
+ if (it.iconPath && it.iconPath.indexOf(imageHgPath) < 0) {
|
|
|
+ it.iconPath = imageHgPath + it.iconPath
|
|
|
+ }
|
|
|
+ if (it.iconThumPath && it.iconThumPath.indexOf(imageHgPath) < 0) {
|
|
|
+ it.iconThumPath = imageHgPath + it.iconThumPath
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (it.iconPath && it.iconPath.indexOf(imagePath) < 0) {
|
|
|
+ it.iconPath = imagePath + it.iconPath
|
|
|
+ }
|
|
|
+ if (it.iconThumPath && it.iconThumPath.indexOf(imagePath) < 0) {
|
|
|
+ it.iconThumPath = imagePath + it.iconThumPath
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function setImagePathForm(it, imagePath, imageHgPath) {
|
|
|
+ // 根据图标来源设置绝对路径
|
|
|
+ if (it.path_type == Constants.PATH_TYPE.HG) {
|
|
|
+ if (it.icon_path && it.icon_path.indexOf(imageHgPath) < 0) {
|
|
|
+ it.icon_path = imageHgPath + it.icon_path
|
|
|
+ }
|
|
|
+ if (it.icon_thum_path && it.icon_thum_path.indexOf(imageHgPath) < 0) {
|
|
|
+ it.icon_thum_path = imageHgPath + it.icon_thum_path
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (it.icon_path && it.icon_path.indexOf(imagePath) < 0) {
|
|
|
+ it.icon_path = imagePath + it.icon_path
|
|
|
+ }
|
|
|
+ if (it.icon_thum_path && it.icon_thum_path.indexOf(imagePath) < 0) {
|
|
|
+ it.icon_thum_path = imagePath + it.icon_thum_path
|
|
|
+ }
|
|
|
}
|
|
|
- })
|
|
|
-}
|
|
|
+}
|
|
|
+/**
|
|
|
+* @desc : 设置行的图标路径
|
|
|
+* @date : 2022/7/5 16:49
|
|
|
+* @author : 周兴
|
|
|
+*/
|
|
|
+function setRowImagePath(it) {
|
|
|
+ let imagePath = config.server_img_http;
|
|
|
+ let imageHgPath = config.server_hg_img_http;
|
|
|
+ // 根据图标来源设置绝对路径
|
|
|
+ setImagePath(it, imagePath, imageHgPath);
|
|
|
+}
|
|
|
|
|
|
/**
|
|
|
* 本接口提供由坐标到坐标所在位置的文字描述的转换,输入坐标返回地理位置信息和附近poi列表。
|
|
|
* @param {*} loc
|
|
|
*/
|
|
|
function reverseGeocoder(loc) {
|
|
|
- return new Promise(resolve => {
|
|
|
- qqmapsdk.reverseGeocoder({
|
|
|
- location: {
|
|
|
- latitude: loc.latitude,
|
|
|
- longitude: loc.longitude
|
|
|
- } || '',
|
|
|
- //get_poi: 1, //是否返回周边POI列表:1.返回;0不返回(默认),非必须参数
|
|
|
- success: function (res) {//成功后的回调
|
|
|
- resolve(res)
|
|
|
- },
|
|
|
- fail: function (error) {
|
|
|
- resolve('')
|
|
|
- },
|
|
|
- complete: function (res) {
|
|
|
- }
|
|
|
- })
|
|
|
- });
|
|
|
+ return new Promise(resolve => {
|
|
|
+ qqmapsdk.reverseGeocoder({
|
|
|
+ location: {
|
|
|
+ latitude: loc.latitude,
|
|
|
+ longitude: loc.longitude
|
|
|
+ } || '',
|
|
|
+ //get_poi: 1, //是否返回周边POI列表:1.返回;0不返回(默认),非必须参数
|
|
|
+ success: function (res) {//成功后的回调
|
|
|
+ resolve(res)
|
|
|
+ },
|
|
|
+ fail: function (error) {
|
|
|
+ resolve('')
|
|
|
+ },
|
|
|
+ complete: function (res) {
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -167,27 +251,27 @@ function reverseGeocoder(loc) {
|
|
|
* @param {*} toloc
|
|
|
*/
|
|
|
function calculateDistance(fromloc, toloc) {
|
|
|
- return new Promise(resolve => {
|
|
|
- //调用距离计算接口
|
|
|
- qqmapsdk.calculateDistance({
|
|
|
- //mode: 'straight',//可选值:'driving'(驾车)、'walking'(步行),不填默认:'walking',可不填 新增直线距离计算,‘straight’(直线)
|
|
|
- //from参数不填默认当前地址
|
|
|
- //获取表单提交的经纬度并设置from和to参数(示例为string格式)
|
|
|
- from: fromloc, //若起点有数据则采用起点坐标,若为空默认当前地址
|
|
|
- to: toloc, //终点坐标
|
|
|
- success: function (res) {//成功后的回调
|
|
|
- var destinationDistance = res.result.elements[0].distance;
|
|
|
- console.log("calculateDistance-ok", res);
|
|
|
- resolve(destinationDistance)
|
|
|
- },
|
|
|
- fail: function (error) {
|
|
|
- console.log("calculateDistance-error", error);
|
|
|
- resolve(0)
|
|
|
- },
|
|
|
- complete: function (res) {
|
|
|
- }
|
|
|
+ return new Promise(resolve => {
|
|
|
+ //调用距离计算接口
|
|
|
+ qqmapsdk.calculateDistance({
|
|
|
+ //mode: 'straight',//可选值:'driving'(驾车)、'walking'(步行),不填默认:'walking',可不填 新增直线距离计算,‘straight’(直线)
|
|
|
+ //from参数不填默认当前地址
|
|
|
+ //获取表单提交的经纬度并设置from和to参数(示例为string格式)
|
|
|
+ from: fromloc, //若起点有数据则采用起点坐标,若为空默认当前地址
|
|
|
+ to: toloc, //终点坐标
|
|
|
+ success: function (res) {//成功后的回调
|
|
|
+ var destinationDistance = res.result.elements[0].distance;
|
|
|
+
|
|
|
+ resolve(destinationDistance)
|
|
|
+ },
|
|
|
+ fail: function (error) {
|
|
|
+
|
|
|
+ resolve(0)
|
|
|
+ },
|
|
|
+ complete: function (res) {
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -197,14 +281,14 @@ function calculateDistance(fromloc, toloc) {
|
|
|
* @param {*} lng
|
|
|
*/
|
|
|
function bdMap_to_wxMap(lat, lng) {
|
|
|
- let pi = 3.14159265358979324 * 3000.0 / 180.0;
|
|
|
- let x = lng - 0.0065;
|
|
|
- let y = lat - 0.006;
|
|
|
- var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * pi);
|
|
|
- var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * pi);
|
|
|
- let lngv = z * Math.cos(theta);
|
|
|
- let latv = z * Math.sin(theta);
|
|
|
- return { 'longitude': lngv, 'latitude': latv };
|
|
|
+ let pi = 3.14159265358979324 * 3000.0 / 180.0;
|
|
|
+ let x = lng - 0.0065;
|
|
|
+ let y = lat - 0.006;
|
|
|
+ var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * pi);
|
|
|
+ var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * pi);
|
|
|
+ let lngv = z * Math.cos(theta);
|
|
|
+ let latv = z * Math.sin(theta);
|
|
|
+ return { 'longitude': lngv, 'latitude': latv };
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -213,33 +297,122 @@ function bdMap_to_wxMap(lat, lng) {
|
|
|
* @param {*} lng
|
|
|
*/
|
|
|
function wxMap_to_bdMap(lat, lng) {
|
|
|
- let pi = 3.14159265358979324 * 3000.0 / 180.0;
|
|
|
- let x = lng;
|
|
|
- let y = lat;
|
|
|
- var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * pi);
|
|
|
- var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * pi);
|
|
|
- let lngv = z * Math.cos(theta) + 0.0065;
|
|
|
- let latv = z * Math.sin(theta) + 0.006;
|
|
|
- return { 'longitude': lngv, 'latitude': latv };
|
|
|
+ let pi = 3.14159265358979324 * 3000.0 / 180.0;
|
|
|
+ let x = lng;
|
|
|
+ let y = lat;
|
|
|
+ var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * pi);
|
|
|
+ var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * pi);
|
|
|
+ let lngv = z * Math.cos(theta) + 0.0065;
|
|
|
+ let latv = z * Math.sin(theta) + 0.006;
|
|
|
+ return { 'longitude': lngv, 'latitude': latv };
|
|
|
}
|
|
|
/**
|
|
|
* 在onload时间中新建qq地址对象
|
|
|
*/
|
|
|
function openQQMap() {
|
|
|
- if (qqmapsdk === undefined || qqmapsdk === null) {
|
|
|
- qqmapsdk = new QQMapWX({
|
|
|
- key: '7I3BZ-VADCX-TJQ4C-TN5O4-F4BZE-RDFCK'
|
|
|
- });
|
|
|
- }
|
|
|
+ if (qqmapsdk === undefined || qqmapsdk === null) {
|
|
|
+ qqmapsdk = new QQMapWX({
|
|
|
+ key: '7I3BZ-VADCX-TJQ4C-TN5O4-F4BZE-RDFCK'
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @desc : 计算品类数
|
|
|
+ * @date : 2022/7/11 16:49
|
|
|
+ * @author : 周兴
|
|
|
+ */
|
|
|
+function getCategoryQuantity(goodsList) {
|
|
|
+ let categoryQuantityList = [] // 品类数
|
|
|
+ goodsList.forEach(res => {
|
|
|
+ // 如果有子级,计算子级的数量
|
|
|
+ if (res.goodsSkuList && res.goodsSkuList.length > 0) {
|
|
|
+ res.goodsSkuList.forEach(it => {
|
|
|
+ if (it.skuSpecs == null) {
|
|
|
+ it.skuSpecs = " "
|
|
|
+ }
|
|
|
+ if (it.skuSpecs && !categoryQuantityList.includes(it.skuSpecs) && !it.flgBomCombined) {
|
|
|
+ categoryQuantityList.push(it.skuSpecs)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if (res.skuSpecs == null) {
|
|
|
+ res.skuSpecs = " "
|
|
|
+ }
|
|
|
+ // 如果没有子级,就加上即可
|
|
|
+ if (res.skuSpecs && !categoryQuantityList.includes(res.skuSpecs) && !res.flgBomCombined) {
|
|
|
+ categoryQuantityList.push(res.skuSpecs)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return categoryQuantityList.length;
|
|
|
}
|
|
|
/**
|
|
|
+ * @desc : 重新计算最后一条金额(用父级去减去其他的金额,计算最后一条)
|
|
|
+ * @date : 2022/7/7 16:49
|
|
|
+ * @author : 周兴
|
|
|
+ */
|
|
|
+function countLastAmount(choosedGoodsList, followFlag) {
|
|
|
+ if (choosedGoodsList && choosedGoodsList.length > 0) {
|
|
|
+ let pRows = choosedGoodsList.filter(it => !it.parentId || it.parentId == null);
|
|
|
+ if (pRows && pRows.length > 0) {
|
|
|
+ pRows.forEach(it => {
|
|
|
+ if (it.goodsSkuList != null && it.goodsSkuList.length > 0) {
|
|
|
+ // 获取子级
|
|
|
+ let childRows = it.goodsSkuList.filter(row => row.parentId == it.id && row.hasChild == 0);
|
|
|
+
|
|
|
+
|
|
|
+ let amount = Number(it.itemAmount); // 父级的金额
|
|
|
+
|
|
|
+ if (childRows && childRows.length > 0) {
|
|
|
+ // 只到倒数第二条
|
|
|
+ for (let i = 0; i < childRows.length - 1; i++) {
|
|
|
+
|
|
|
+ amount = util.SubNumber(amount, Number(childRows[i].itemAmount))
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果是退换补,还需要给实际赋值 //于继渤 添加else分支 不然 退还补 选完bom 价格出现NAN 报错 2022/07/21
|
|
|
+ childRows[childRows.length - 1].itemAmount = amount;
|
|
|
+ childRows[childRows.length - 1].priceSale = Number(childRows[childRows.length - 1].itemAmount / childRows[childRows.length - 1].itemQuantity).toFixed(2)
|
|
|
+ if (followFlag) {
|
|
|
+ childRows[childRows.length - 1].tItemAmount = amount;
|
|
|
+ childRows[childRows.length - 1].priceSale = Number(childRows[childRows.length - 1].tItemAmount / childRows[childRows.length - 1].tItemQuantity).toFixed(2)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
* 判断是否有按钮权限
|
|
|
* @param {*} functionCode
|
|
|
*/
|
|
|
function hasButtonRight(functionCode) {
|
|
|
- let buttonRights = app.globalData.buttonRights
|
|
|
- let orderAuditVisible = buttonRights.indexOf(functionCode)
|
|
|
- return orderAuditVisible == -1 ? false : true
|
|
|
+ let buttonRights = app.globalData.buttonRights
|
|
|
+ let orderAuditVisible = buttonRights.indexOf(functionCode)
|
|
|
+ return orderAuditVisible == -1 ? false : true
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 判断必填项
|
|
|
+ * @param {*} functionCode
|
|
|
+ */
|
|
|
+function hasInputPageItemMust(functionCode) {
|
|
|
+ let pageItemMusts = app.globalData.pageItemMusts
|
|
|
+ console.log('pageItemMusts', pageItemMusts)
|
|
|
+ let orderAuditVisible = false
|
|
|
+ pageItemMusts.forEach(res => {
|
|
|
+ if (res.itemCodeTag['WX-CODE'] && res.itemCodeTag['WX-CODE'].indexOf(functionCode) != -1 && res.flgMustItem) {
|
|
|
+ orderAuditVisible = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ return orderAuditVisible
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -247,26 +420,59 @@ function hasButtonRight(functionCode) {
|
|
|
* @param {*} functionCode
|
|
|
*/
|
|
|
function hasPageUUidRight(uuid) {
|
|
|
- let pageRights = app.globalData.pageRights
|
|
|
- let pageVisible = pageRights.indexOf(uuid)
|
|
|
- return pageVisible == -1 ? false : true
|
|
|
+ if (uuid) {
|
|
|
+ let pageRights = app.globalData.pageRights
|
|
|
+ let pageVisible = pageRights.indexOf(uuid)
|
|
|
+ return pageVisible == -1 ? false : true
|
|
|
+ } else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
+function isUserSensitive() {
|
|
|
+ //敏感信息控制
|
|
|
+ if (app.globalData.user.userSensitive && app.globalData.user.userSensitive.length > 0) {
|
|
|
+ let userSensitive = app.globalData.user.userSensitive
|
|
|
+ let purchasePriceFlag = true
|
|
|
+ userSensitive.forEach(res => {
|
|
|
+ if (res.isCheck) {
|
|
|
+ if (res.docCode == '分销采购订单' && res.itemName == '采购价格' && res.isCheck) {
|
|
|
+ // purchasePriceFlag = false
|
|
|
+ purchasePriceFlag = true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ purchasePriceFlag = false
|
|
|
+ }
|
|
|
|
|
|
+ })
|
|
|
+ return purchasePriceFlag
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+}
|
|
|
/**
|
|
|
* 导出函数
|
|
|
*/
|
|
|
module.exports = {
|
|
|
- openQQMap,
|
|
|
- navigate,
|
|
|
- reverseGeocoder,
|
|
|
- calculateDistance,
|
|
|
- hasButtonRight,
|
|
|
- hasRight,
|
|
|
- wxMap_to_bdMap,
|
|
|
- bdMap_to_wxMap,
|
|
|
- onClickWxchartAddress,
|
|
|
- hasPageUUidRight ,
|
|
|
- toThousandCents
|
|
|
+ openQQMap,
|
|
|
+ navigate,
|
|
|
+ toThousandCents,
|
|
|
+ reverseGeocoder,
|
|
|
+ calculateDistance,
|
|
|
+ hasButtonRight,
|
|
|
+ hasRight,
|
|
|
+ wxMap_to_bdMap,
|
|
|
+ bdMap_to_wxMap,
|
|
|
+ setSkuIcon,
|
|
|
+ setRowImagePath,
|
|
|
+ onClickWxchartAddress,
|
|
|
+ countLastAmount,
|
|
|
+ getCategoryQuantity,
|
|
|
+ setImagePath,
|
|
|
+ hasPageUUidRight,
|
|
|
+ setImagePathForm,
|
|
|
+ hasInputPageItemMust,
|
|
|
+ isUserSensitive
|
|
|
}
|
|
|
|
|
|
|