处理工单接口调整
parent
487c8099a9
commit
eb1c0ac14d
10
App.vue
10
App.vue
|
@ -16,14 +16,16 @@
|
|||
this.globalData.hostapi = 'https://7and5.cn';
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
this.globalData.hostapi = 'https://7and5.cn';
|
||||
// this.globalData.hostapi = '/web';
|
||||
// this.globalData.hostapi = 'https://7and5.cn';
|
||||
this.globalData.hostapi = '/web';
|
||||
// #endif
|
||||
},
|
||||
onShow: function() {
|
||||
// if(uni.getStorageSync('token')){
|
||||
// // 刷新token
|
||||
// this.$toolAll.tools.refreshToken();
|
||||
// 刷新token
|
||||
// this.$toolAll.tools.refreshToken();
|
||||
// 每十分钟更新用户地理位置
|
||||
this.$toolAll.tools.renewLocationEv();
|
||||
// }
|
||||
},
|
||||
onHide: function() {
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
const fsm = wx.getFileSystemManager();
|
||||
const FILE_BASE_NAME = 'tmp_base64src'; //自定义文件名
|
||||
|
||||
function base64src(base64data, cb) {
|
||||
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64data) || [];
|
||||
if (!format) {
|
||||
return (new Error('ERROR_BASE64SRC_PARSE'));
|
||||
}
|
||||
const filePath = `${wx.env.USER_DATA_PATH}/${FILE_BASE_NAME}.${format}`;
|
||||
const buffer = wx.base64ToArrayBuffer(bodyData);
|
||||
fsm.writeFile({
|
||||
filePath,
|
||||
data: buffer,
|
||||
encoding: 'binary',
|
||||
success() {
|
||||
cb(filePath);
|
||||
},
|
||||
fail() {
|
||||
return (new Error('ERROR_BASE64SRC_WRITE'));
|
||||
},
|
||||
});
|
||||
};
|
||||
module.exports = base64src;
|
|
@ -0,0 +1,891 @@
|
|||
var ERROR_CONF = {
|
||||
KEY_ERR: 311,
|
||||
KEY_ERR_MSG: 'key格式错误',
|
||||
PARAM_ERR: 310,
|
||||
PARAM_ERR_MSG: '请求参数信息有误',
|
||||
SYSTEM_ERR: 600,
|
||||
SYSTEM_ERR_MSG: '系统错误',
|
||||
WX_ERR_CODE: 1000,
|
||||
WX_OK_CODE: 200
|
||||
};
|
||||
var BASE_URL = 'https://apis.map.qq.com/ws/';
|
||||
var URL_SEARCH = BASE_URL + 'place/v1/search';
|
||||
var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion';
|
||||
var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/';
|
||||
var URL_CITY_LIST = BASE_URL + 'district/v1/list';
|
||||
var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren';
|
||||
var URL_DISTANCE = BASE_URL + 'distance/v1/';
|
||||
var URL_DIRECTION = BASE_URL + 'direction/v1/';
|
||||
var MODE = {
|
||||
driving: 'driving',
|
||||
transit: 'transit'
|
||||
};
|
||||
var EARTH_RADIUS = 6378136.49;
|
||||
var Utils = {
|
||||
safeAdd(x, y) {
|
||||
var lsw = (x & 0xffff) + (y & 0xffff);
|
||||
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
||||
return (msw << 16) | (lsw & 0xffff)
|
||||
},
|
||||
bitRotateLeft(num, cnt) {
|
||||
return (num << cnt) | (num >>> (32 - cnt))
|
||||
},
|
||||
md5cmn(q, a, b, x, s, t) {
|
||||
return this.safeAdd(this.bitRotateLeft(this.safeAdd(this.safeAdd(a, q), this.safeAdd(x, t)), s), b)
|
||||
},
|
||||
md5ff(a, b, c, d, x, s, t) {
|
||||
return this.md5cmn((b & c) | (~b & d), a, b, x, s, t)
|
||||
},
|
||||
md5gg(a, b, c, d, x, s, t) {
|
||||
return this.md5cmn((b & d) | (c & ~d), a, b, x, s, t)
|
||||
},
|
||||
md5hh(a, b, c, d, x, s, t) {
|
||||
return this.md5cmn(b ^ c ^ d, a, b, x, s, t)
|
||||
},
|
||||
md5ii(a, b, c, d, x, s, t) {
|
||||
return this.md5cmn(c ^ (b | ~d), a, b, x, s, t)
|
||||
},
|
||||
binlMD5(x, len) {
|
||||
x[len >> 5] |= 0x80 << (len % 32);
|
||||
x[((len + 64) >>> 9 << 4) + 14] = len;
|
||||
var i;
|
||||
var olda;
|
||||
var oldb;
|
||||
var oldc;
|
||||
var oldd;
|
||||
var a = 1732584193;
|
||||
var b = -271733879;
|
||||
var c = -1732584194;
|
||||
var d = 271733878;
|
||||
for (i = 0; i < x.length; i += 16) {
|
||||
olda = a;
|
||||
oldb = b;
|
||||
oldc = c;
|
||||
oldd = d;
|
||||
a = this.md5ff(a, b, c, d, x[i], 7, -680876936);
|
||||
d = this.md5ff(d, a, b, c, x[i + 1], 12, -389564586);
|
||||
c = this.md5ff(c, d, a, b, x[i + 2], 17, 606105819);
|
||||
b = this.md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
||||
a = this.md5ff(a, b, c, d, x[i + 4], 7, -176418897);
|
||||
d = this.md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
||||
c = this.md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
||||
b = this.md5ff(b, c, d, a, x[i + 7], 22, -45705983);
|
||||
a = this.md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
||||
d = this.md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
||||
c = this.md5ff(c, d, a, b, x[i + 10], 17, -42063);
|
||||
b = this.md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
||||
a = this.md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
||||
d = this.md5ff(d, a, b, c, x[i + 13], 12, -40341101);
|
||||
c = this.md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
||||
b = this.md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
||||
a = this.md5gg(a, b, c, d, x[i + 1], 5, -165796510);
|
||||
d = this.md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
||||
c = this.md5gg(c, d, a, b, x[i + 11], 14, 643717713);
|
||||
b = this.md5gg(b, c, d, a, x[i], 20, -373897302);
|
||||
a = this.md5gg(a, b, c, d, x[i + 5], 5, -701558691);
|
||||
d = this.md5gg(d, a, b, c, x[i + 10], 9, 38016083);
|
||||
c = this.md5gg(c, d, a, b, x[i + 15], 14, -660478335);
|
||||
b = this.md5gg(b, c, d, a, x[i + 4], 20, -405537848);
|
||||
a = this.md5gg(a, b, c, d, x[i + 9], 5, 568446438);
|
||||
d = this.md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
||||
c = this.md5gg(c, d, a, b, x[i + 3], 14, -187363961);
|
||||
b = this.md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
||||
a = this.md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
||||
d = this.md5gg(d, a, b, c, x[i + 2], 9, -51403784);
|
||||
c = this.md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
||||
b = this.md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
||||
a = this.md5hh(a, b, c, d, x[i + 5], 4, -378558);
|
||||
d = this.md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
||||
c = this.md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
||||
b = this.md5hh(b, c, d, a, x[i + 14], 23, -35309556);
|
||||
a = this.md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
||||
d = this.md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
||||
c = this.md5hh(c, d, a, b, x[i + 7], 16, -155497632);
|
||||
b = this.md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
||||
a = this.md5hh(a, b, c, d, x[i + 13], 4, 681279174);
|
||||
d = this.md5hh(d, a, b, c, x[i], 11, -358537222);
|
||||
c = this.md5hh(c, d, a, b, x[i + 3], 16, -722521979);
|
||||
b = this.md5hh(b, c, d, a, x[i + 6], 23, 76029189);
|
||||
a = this.md5hh(a, b, c, d, x[i + 9], 4, -640364487);
|
||||
d = this.md5hh(d, a, b, c, x[i + 12], 11, -421815835);
|
||||
c = this.md5hh(c, d, a, b, x[i + 15], 16, 530742520);
|
||||
b = this.md5hh(b, c, d, a, x[i + 2], 23, -995338651);
|
||||
a = this.md5ii(a, b, c, d, x[i], 6, -198630844);
|
||||
d = this.md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
||||
c = this.md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
||||
b = this.md5ii(b, c, d, a, x[i + 5], 21, -57434055);
|
||||
a = this.md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
||||
d = this.md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
||||
c = this.md5ii(c, d, a, b, x[i + 10], 15, -1051523);
|
||||
b = this.md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
||||
a = this.md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
||||
d = this.md5ii(d, a, b, c, x[i + 15], 10, -30611744);
|
||||
c = this.md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
||||
b = this.md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
||||
a = this.md5ii(a, b, c, d, x[i + 4], 6, -145523070);
|
||||
d = this.md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
||||
c = this.md5ii(c, d, a, b, x[i + 2], 15, 718787259);
|
||||
b = this.md5ii(b, c, d, a, x[i + 9], 21, -343485551);
|
||||
a = this.safeAdd(a, olda);
|
||||
b = this.safeAdd(b, oldb);
|
||||
c = this.safeAdd(c, oldc);
|
||||
d = this.safeAdd(d, oldd)
|
||||
}
|
||||
return [a, b, c, d]
|
||||
},
|
||||
binl2rstr(input) {
|
||||
var i;
|
||||
var output = '';
|
||||
var length32 = input.length * 32;
|
||||
for (i = 0; i < length32; i += 8) {
|
||||
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff)
|
||||
}
|
||||
return output
|
||||
},
|
||||
rstr2binl(input) {
|
||||
var i;
|
||||
var output = [];
|
||||
output[(input.length >> 2) - 1] = undefined;
|
||||
for (i = 0; i < output.length; i += 1) {
|
||||
output[i] = 0
|
||||
}
|
||||
var length8 = input.length * 8;
|
||||
for (i = 0; i < length8; i += 8) {
|
||||
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32)
|
||||
}
|
||||
return output
|
||||
},
|
||||
rstrMD5(s) {
|
||||
return this.binl2rstr(this.binlMD5(this.rstr2binl(s), s.length * 8))
|
||||
},
|
||||
rstrHMACMD5(key, data) {
|
||||
var i;
|
||||
var bkey = this.rstr2binl(key);
|
||||
var ipad = [];
|
||||
var opad = [];
|
||||
var hash;
|
||||
ipad[15] = opad[15] = undefined;
|
||||
if (bkey.length > 16) {
|
||||
bkey = this.binlMD5(bkey, key.length * 8)
|
||||
}
|
||||
for (i = 0; i < 16; i += 1) {
|
||||
ipad[i] = bkey[i] ^ 0x36363636;
|
||||
opad[i] = bkey[i] ^ 0x5c5c5c5c
|
||||
}
|
||||
hash = this.binlMD5(ipad.concat(this.rstr2binl(data)), 512 + data.length * 8);
|
||||
return this.binl2rstr(this.binlMD5(opad.concat(hash), 512 + 128))
|
||||
},
|
||||
rstr2hex(input) {
|
||||
var hexTab = '0123456789abcdef';
|
||||
var output = '';
|
||||
var x;
|
||||
var i;
|
||||
for (i = 0; i < input.length; i += 1) {
|
||||
x = input.charCodeAt(i);
|
||||
output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f)
|
||||
}
|
||||
return output
|
||||
},
|
||||
str2rstrUTF8(input) {
|
||||
return unescape(encodeURIComponent(input))
|
||||
},
|
||||
rawMD5(s) {
|
||||
return this.rstrMD5(this.str2rstrUTF8(s))
|
||||
},
|
||||
hexMD5(s) {
|
||||
return this.rstr2hex(this.rawMD5(s))
|
||||
},
|
||||
rawHMACMD5(k, d) {
|
||||
return this.rstrHMACMD5(this.str2rstrUTF8(k), str2rstrUTF8(d))
|
||||
},
|
||||
hexHMACMD5(k, d) {
|
||||
return this.rstr2hex(this.rawHMACMD5(k, d))
|
||||
},
|
||||
md5(string, key, raw) {
|
||||
if (!key) {
|
||||
if (!raw) {
|
||||
return this.hexMD5(string)
|
||||
}
|
||||
return this.rawMD5(string)
|
||||
}
|
||||
if (!raw) {
|
||||
return this.hexHMACMD5(key, string)
|
||||
}
|
||||
return this.rawHMACMD5(key, string)
|
||||
},
|
||||
getSig(requestParam, sk, feature, mode) {
|
||||
var sig = null;
|
||||
var requestArr = [];
|
||||
Object.keys(requestParam).sort().forEach(function(key) {
|
||||
requestArr.push(key + '=' + requestParam[key])
|
||||
});
|
||||
if (feature == 'search') {
|
||||
sig = '/ws/place/v1/search?' + requestArr.join('&') + sk
|
||||
}
|
||||
if (feature == 'suggest') {
|
||||
sig = '/ws/place/v1/suggestion?' + requestArr.join('&') + sk
|
||||
}
|
||||
if (feature == 'reverseGeocoder') {
|
||||
sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk
|
||||
}
|
||||
if (feature == 'geocoder') {
|
||||
sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk
|
||||
}
|
||||
if (feature == 'getCityList') {
|
||||
sig = '/ws/district/v1/list?' + requestArr.join('&') + sk
|
||||
}
|
||||
if (feature == 'getDistrictByCityId') {
|
||||
sig = '/ws/district/v1/getchildren?' + requestArr.join('&') + sk
|
||||
}
|
||||
if (feature == 'calculateDistance') {
|
||||
sig = '/ws/distance/v1/?' + requestArr.join('&') + sk
|
||||
}
|
||||
if (feature == 'direction') {
|
||||
sig = '/ws/direction/v1/' + mode + '?' + requestArr.join('&') + sk
|
||||
}
|
||||
sig = this.md5(sig);
|
||||
return sig
|
||||
},
|
||||
location2query(data) {
|
||||
if (typeof data == 'string') {
|
||||
return data
|
||||
}
|
||||
var query = '';
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var d = data[i];
|
||||
if (!!query) {
|
||||
query += ';'
|
||||
}
|
||||
if (d.location) {
|
||||
query = query + d.location.lat + ',' + d.location.lng
|
||||
}
|
||||
if (d.latitude && d.longitude) {
|
||||
query = query + d.latitude + ',' + d.longitude
|
||||
}
|
||||
}
|
||||
return query
|
||||
},
|
||||
rad(d) {
|
||||
return d * Math.PI / 180.0
|
||||
},
|
||||
getEndLocation(location) {
|
||||
var to = location.split(';');
|
||||
var endLocation = [];
|
||||
for (var i = 0; i < to.length; i++) {
|
||||
endLocation.push({
|
||||
lat: parseFloat(to[i].split(',')[0]),
|
||||
lng: parseFloat(to[i].split(',')[1])
|
||||
})
|
||||
}
|
||||
return endLocation
|
||||
},
|
||||
getDistance(latFrom, lngFrom, latTo, lngTo) {
|
||||
var radLatFrom = this.rad(latFrom);
|
||||
var radLatTo = this.rad(latTo);
|
||||
var a = radLatFrom - radLatTo;
|
||||
var b = this.rad(lngFrom) - this.rad(lngTo);
|
||||
var distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLatFrom) * Math.cos(
|
||||
radLatTo) * Math.pow(Math.sin(b / 2), 2)));
|
||||
distance = distance * EARTH_RADIUS;
|
||||
distance = Math.round(distance * 10000) / 10000;
|
||||
return parseFloat(distance.toFixed(0))
|
||||
},
|
||||
getWXLocation(success, fail, complete) {
|
||||
wx.getLocation({
|
||||
type: 'gcj02',
|
||||
success: success,
|
||||
fail: fail,
|
||||
complete: complete
|
||||
})
|
||||
},
|
||||
getLocationParam(location) {
|
||||
if (typeof location == 'string') {
|
||||
var locationArr = location.split(',');
|
||||
if (locationArr.length === 2) {
|
||||
location = {
|
||||
latitude: location.split(',')[0],
|
||||
longitude: location.split(',')[1]
|
||||
}
|
||||
} else {
|
||||
location = {}
|
||||
}
|
||||
}
|
||||
return location
|
||||
},
|
||||
polyfillParam(param) {
|
||||
param.success = param.success || function() {};
|
||||
param.fail = param.fail || function() {};
|
||||
param.complete = param.complete || function() {}
|
||||
},
|
||||
checkParamKeyEmpty(param, key) {
|
||||
if (!param[key]) {
|
||||
var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + key + '参数格式有误');
|
||||
param.fail(errconf);
|
||||
param.complete(errconf);
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
checkKeyword(param) {
|
||||
return !this.checkParamKeyEmpty(param, 'keyword')
|
||||
},
|
||||
checkLocation(param) {
|
||||
var location = this.getLocationParam(param.location);
|
||||
if (!location || !location.latitude || !location.longitude) {
|
||||
var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误');
|
||||
param.fail(errconf);
|
||||
param.complete(errconf);
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
buildErrorConfig(errCode, errMsg) {
|
||||
return {
|
||||
status: errCode,
|
||||
message: errMsg
|
||||
}
|
||||
},
|
||||
handleData(param, data, feature) {
|
||||
if (feature == 'search') {
|
||||
var searchResult = data.data;
|
||||
var searchSimplify = [];
|
||||
for (var i = 0; i < searchResult.length; i++) {
|
||||
searchSimplify.push({
|
||||
id: searchResult[i].id || null,
|
||||
title: searchResult[i].title || null,
|
||||
latitude: searchResult[i].location && searchResult[i].location.lat || null,
|
||||
longitude: searchResult[i].location && searchResult[i].location.lng || null,
|
||||
address: searchResult[i].address || null,
|
||||
category: searchResult[i].category || null,
|
||||
tel: searchResult[i].tel || null,
|
||||
adcode: searchResult[i].ad_info && searchResult[i].ad_info.adcode || null,
|
||||
city: searchResult[i].ad_info && searchResult[i].ad_info.city || null,
|
||||
district: searchResult[i].ad_info && searchResult[i].ad_info.district || null,
|
||||
province: searchResult[i].ad_info && searchResult[i].ad_info.province || null
|
||||
})
|
||||
}
|
||||
param.success(data, {
|
||||
searchResult: searchResult,
|
||||
searchSimplify: searchSimplify
|
||||
})
|
||||
} else if (feature == 'suggest') {
|
||||
var suggestResult = data.data;
|
||||
var suggestSimplify = [];
|
||||
for (var i = 0; i < suggestResult.length; i++) {
|
||||
suggestSimplify.push({
|
||||
adcode: suggestResult[i].adcode || null,
|
||||
address: suggestResult[i].address || null,
|
||||
category: suggestResult[i].category || null,
|
||||
city: suggestResult[i].city || null,
|
||||
district: suggestResult[i].district || null,
|
||||
id: suggestResult[i].id || null,
|
||||
latitude: suggestResult[i].location && suggestResult[i].location.lat || null,
|
||||
longitude: suggestResult[i].location && suggestResult[i].location.lng || null,
|
||||
province: suggestResult[i].province || null,
|
||||
title: suggestResult[i].title || null,
|
||||
type: suggestResult[i].type || null
|
||||
})
|
||||
}
|
||||
param.success(data, {
|
||||
suggestResult: suggestResult,
|
||||
suggestSimplify: suggestSimplify
|
||||
})
|
||||
} else if (feature == 'reverseGeocoder') {
|
||||
var reverseGeocoderResult = data.result;
|
||||
var reverseGeocoderSimplify = {
|
||||
address: reverseGeocoderResult.address || null,
|
||||
latitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lat || null,
|
||||
longitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lng || null,
|
||||
adcode: reverseGeocoderResult.ad_info && reverseGeocoderResult.ad_info.adcode || null,
|
||||
city: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.city ||
|
||||
null,
|
||||
district: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component
|
||||
.district || null,
|
||||
nation: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component
|
||||
.nation || null,
|
||||
province: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component
|
||||
.province || null,
|
||||
street: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component
|
||||
.street || null,
|
||||
street_number: reverseGeocoderResult.address_component && reverseGeocoderResult
|
||||
.address_component.street_number || null,
|
||||
recommend: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult
|
||||
.formatted_addresses.recommend || null,
|
||||
rough: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses
|
||||
.rough || null
|
||||
};
|
||||
if (reverseGeocoderResult.pois) {
|
||||
var pois = reverseGeocoderResult.pois;
|
||||
var poisSimplify = [];
|
||||
for (var i = 0; i < pois.length; i++) {
|
||||
poisSimplify.push({
|
||||
id: pois[i].id || null,
|
||||
title: pois[i].title || null,
|
||||
latitude: pois[i].location && pois[i].location.lat || null,
|
||||
longitude: pois[i].location && pois[i].location.lng || null,
|
||||
address: pois[i].address || null,
|
||||
category: pois[i].category || null,
|
||||
adcode: pois[i].ad_info && pois[i].ad_info.adcode || null,
|
||||
city: pois[i].ad_info && pois[i].ad_info.city || null,
|
||||
district: pois[i].ad_info && pois[i].ad_info.district || null,
|
||||
province: pois[i].ad_info && pois[i].ad_info.province || null
|
||||
})
|
||||
}
|
||||
param.success(data, {
|
||||
reverseGeocoderResult: reverseGeocoderResult,
|
||||
reverseGeocoderSimplify: reverseGeocoderSimplify,
|
||||
pois: pois,
|
||||
poisSimplify: poisSimplify
|
||||
})
|
||||
} else {
|
||||
param.success(data, {
|
||||
reverseGeocoderResult: reverseGeocoderResult,
|
||||
reverseGeocoderSimplify: reverseGeocoderSimplify
|
||||
})
|
||||
}
|
||||
} else if (feature == 'geocoder') {
|
||||
var geocoderResult = data.result;
|
||||
var geocoderSimplify = {
|
||||
title: geocoderResult.title || null,
|
||||
latitude: geocoderResult.location && geocoderResult.location.lat || null,
|
||||
longitude: geocoderResult.location && geocoderResult.location.lng || null,
|
||||
adcode: geocoderResult.ad_info && geocoderResult.ad_info.adcode || null,
|
||||
province: geocoderResult.address_components && geocoderResult.address_components.province ||
|
||||
null,
|
||||
city: geocoderResult.address_components && geocoderResult.address_components.city || null,
|
||||
district: geocoderResult.address_components && geocoderResult.address_components.district ||
|
||||
null,
|
||||
street: geocoderResult.address_components && geocoderResult.address_components.street || null,
|
||||
street_number: geocoderResult.address_components && geocoderResult.address_components
|
||||
.street_number || null,
|
||||
level: geocoderResult.level || null
|
||||
};
|
||||
param.success(data, {
|
||||
geocoderResult: geocoderResult,
|
||||
geocoderSimplify: geocoderSimplify
|
||||
})
|
||||
} else if (feature == 'getCityList') {
|
||||
var provinceResult = data.result[0];
|
||||
var cityResult = data.result[1];
|
||||
var districtResult = data.result[2];
|
||||
param.success(data, {
|
||||
provinceResult: provinceResult,
|
||||
cityResult: cityResult,
|
||||
districtResult: districtResult
|
||||
})
|
||||
} else if (feature == 'getDistrictByCityId') {
|
||||
var districtByCity = data.result[0];
|
||||
param.success(data, districtByCity)
|
||||
} else if (feature == 'calculateDistance') {
|
||||
var calculateDistanceResult = data.result.elements;
|
||||
var distance = [];
|
||||
for (var i = 0; i < calculateDistanceResult.length; i++) {
|
||||
distance.push(calculateDistanceResult[i].distance)
|
||||
}
|
||||
param.success(data, {
|
||||
calculateDistanceResult: calculateDistanceResult,
|
||||
distance: distance
|
||||
})
|
||||
} else if (feature == 'direction') {
|
||||
var direction = data.result.routes;
|
||||
param.success(data, direction)
|
||||
} else {
|
||||
param.success(data)
|
||||
}
|
||||
},
|
||||
buildWxRequestConfig(param, options, feature) {
|
||||
var that = this;
|
||||
options.header = {
|
||||
"content-type": "application/json"
|
||||
};
|
||||
options.method = 'GET';
|
||||
options.success = function(res) {
|
||||
var data = res.data;
|
||||
if (data.status === 0) {
|
||||
that.handleData(param, data, feature)
|
||||
} else {
|
||||
param.fail(data)
|
||||
}
|
||||
};
|
||||
options.fail = function(res) {
|
||||
res.statusCode = ERROR_CONF.WX_ERR_CODE;
|
||||
param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg))
|
||||
};
|
||||
options.complete = function(res) {
|
||||
var statusCode = +res.statusCode;
|
||||
switch (statusCode) {
|
||||
case ERROR_CONF.WX_ERR_CODE: {
|
||||
param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
|
||||
break
|
||||
}
|
||||
case ERROR_CONF.WX_OK_CODE: {
|
||||
var data = res.data;
|
||||
if (data.status === 0) {
|
||||
param.complete(data)
|
||||
} else {
|
||||
param.complete(that.buildErrorConfig(data.status, data.message))
|
||||
}
|
||||
break
|
||||
}
|
||||
default: {
|
||||
param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG))
|
||||
}
|
||||
}
|
||||
};
|
||||
return options
|
||||
},
|
||||
locationProcess(param, locationsuccess, locationfail, locationcomplete) {
|
||||
var that = this;
|
||||
locationfail = locationfail || function(res) {
|
||||
res.statusCode = ERROR_CONF.WX_ERR_CODE;
|
||||
param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg))
|
||||
};
|
||||
locationcomplete = locationcomplete || function(res) {
|
||||
if (res.statusCode == ERROR_CONF.WX_ERR_CODE) {
|
||||
param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg))
|
||||
}
|
||||
};
|
||||
if (!param.location) {
|
||||
that.getWXLocation(locationsuccess, locationfail, locationcomplete)
|
||||
} else if (that.checkLocation(param)) {
|
||||
var location = Utils.getLocationParam(param.location);
|
||||
locationsuccess(location)
|
||||
}
|
||||
}
|
||||
};
|
||||
class QQMapWX {
|
||||
constructor(options) {
|
||||
if (!options.key) {
|
||||
throw Error('key值不能为空')
|
||||
}
|
||||
this.key = options.key
|
||||
};
|
||||
search(options) {
|
||||
var that = this;
|
||||
options = options || {};
|
||||
Utils.polyfillParam(options);
|
||||
if (!Utils.checkKeyword(options)) {
|
||||
return
|
||||
}
|
||||
var requestParam = {
|
||||
keyword: options.keyword,
|
||||
orderby: options.orderby || '_distance',
|
||||
page_size: options.page_size || 10,
|
||||
page_index: options.page_index || 1,
|
||||
output: 'json',
|
||||
key: that.key
|
||||
};
|
||||
if (options.address_format) {
|
||||
requestParam.address_format = options.address_format
|
||||
}
|
||||
if (options.filter) {
|
||||
requestParam.filter = options.filter
|
||||
}
|
||||
var distance = options.distance || "1000";
|
||||
var auto_extend = options.auto_extend || 1;
|
||||
var region = null;
|
||||
var rectangle = null;
|
||||
if (options.region) {
|
||||
region = options.region
|
||||
}
|
||||
if (options.rectangle) {
|
||||
rectangle = options.rectangle
|
||||
}
|
||||
var locationsuccess = function(result) {
|
||||
if (region && !rectangle) {
|
||||
requestParam.boundary = "region(" + region + "," + auto_extend + "," + result.latitude + "," +
|
||||
result.longitude + ")";
|
||||
if (options.sig) {
|
||||
requestParam.sig = Utils.getSig(requestParam, options.sig, 'search')
|
||||
}
|
||||
} else if (rectangle && !region) {
|
||||
requestParam.boundary = "rectangle(" + rectangle + ")";
|
||||
if (options.sig) {
|
||||
requestParam.sig = Utils.getSig(requestParam, options.sig, 'search')
|
||||
}
|
||||
} else {
|
||||
requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance +
|
||||
"," + auto_extend + ")";
|
||||
if (options.sig) {
|
||||
requestParam.sig = Utils.getSig(requestParam, options.sig, 'search')
|
||||
}
|
||||
}
|
||||
wx.request(Utils.buildWxRequestConfig(options, {
|
||||
url: URL_SEARCH,
|
||||
data: requestParam
|
||||
}, 'search'))
|
||||
};
|
||||
Utils.locationProcess(options, locationsuccess)
|
||||
};
|
||||
getSuggestion(options) {
|
||||
var that = this;
|
||||
options = options || {};
|
||||
Utils.polyfillParam(options);
|
||||
if (!Utils.checkKeyword(options)) {
|
||||
return
|
||||
}
|
||||
var requestParam = {
|
||||
keyword: options.keyword,
|
||||
region: options.region || '全国',
|
||||
region_fix: options.region_fix || 0,
|
||||
policy: options.policy || 0,
|
||||
page_size: options.page_size || 10,
|
||||
page_index: options.page_index || 1,
|
||||
get_subpois: options.get_subpois || 0,
|
||||
output: 'json',
|
||||
key: that.key
|
||||
};
|
||||
if (options.address_format) {
|
||||
requestParam.address_format = options.address_format
|
||||
}
|
||||
if (options.filter) {
|
||||
requestParam.filter = options.filter
|
||||
}
|
||||
if (options.location) {
|
||||
var locationsuccess = function(result) {
|
||||
requestParam.location = result.latitude + ',' + result.longitude;
|
||||
if (options.sig) {
|
||||
requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest')
|
||||
}
|
||||
wx.request(Utils.buildWxRequestConfig(options, {
|
||||
url: URL_SUGGESTION,
|
||||
data: requestParam
|
||||
}, "suggest"))
|
||||
};
|
||||
Utils.locationProcess(options, locationsuccess)
|
||||
} else {
|
||||
if (options.sig) {
|
||||
requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest')
|
||||
}
|
||||
wx.request(Utils.buildWxRequestConfig(options, {
|
||||
url: URL_SUGGESTION,
|
||||
data: requestParam
|
||||
}, "suggest"))
|
||||
}
|
||||
};
|
||||
reverseGeocoder(options) {
|
||||
var that = this;
|
||||
options = options || {};
|
||||
Utils.polyfillParam(options);
|
||||
var requestParam = {
|
||||
coord_type: options.coord_type || 5,
|
||||
get_poi: options.get_poi || 0,
|
||||
output: 'json',
|
||||
key: that.key
|
||||
};
|
||||
if (options.poi_options) {
|
||||
requestParam.poi_options = options.poi_options
|
||||
}
|
||||
var locationsuccess = function(result) {
|
||||
requestParam.location = result.latitude + ',' + result.longitude;
|
||||
if (options.sig) {
|
||||
requestParam.sig = Utils.getSig(requestParam, options.sig, 'reverseGeocoder')
|
||||
}
|
||||
wx.request(Utils.buildWxRequestConfig(options, {
|
||||
url: URL_GET_GEOCODER,
|
||||
data: requestParam
|
||||
}, 'reverseGeocoder'))
|
||||
};
|
||||
Utils.locationProcess(options, locationsuccess)
|
||||
};
|
||||
geocoder(options) {
|
||||
var that = this;
|
||||
options = options || {};
|
||||
Utils.polyfillParam(options);
|
||||
if (Utils.checkParamKeyEmpty(options, 'address')) {
|
||||
return
|
||||
}
|
||||
var requestParam = {
|
||||
address: options.address,
|
||||
output: 'json',
|
||||
key: that.key
|
||||
};
|
||||
if (options.region) {
|
||||
requestParam.region = options.region
|
||||
}
|
||||
if (options.sig) {
|
||||
requestParam.sig = Utils.getSig(requestParam, options.sig, 'geocoder')
|
||||
}
|
||||
wx.request(Utils.buildWxRequestConfig(options, {
|
||||
url: URL_GET_GEOCODER,
|
||||
data: requestParam
|
||||
}, 'geocoder'))
|
||||
};
|
||||
getCityList(options) {
|
||||
var that = this;
|
||||
options = options || {};
|
||||
Utils.polyfillParam(options);
|
||||
var requestParam = {
|
||||
output: 'json',
|
||||
key: that.key
|
||||
};
|
||||
if (options.sig) {
|
||||
requestParam.sig = Utils.getSig(requestParam, options.sig, 'getCityList')
|
||||
}
|
||||
wx.request(Utils.buildWxRequestConfig(options, {
|
||||
url: URL_CITY_LIST,
|
||||
data: requestParam
|
||||
}, 'getCityList'))
|
||||
};
|
||||
getDistrictByCityId(options) {
|
||||
var that = this;
|
||||
options = options || {};
|
||||
Utils.polyfillParam(options);
|
||||
if (Utils.checkParamKeyEmpty(options, 'id')) {
|
||||
return
|
||||
}
|
||||
var requestParam = {
|
||||
id: options.id || '',
|
||||
output: 'json',
|
||||
key: that.key
|
||||
};
|
||||
if (options.sig) {
|
||||
requestParam.sig = Utils.getSig(requestParam, options.sig, 'getDistrictByCityId')
|
||||
}
|
||||
wx.request(Utils.buildWxRequestConfig(options, {
|
||||
url: URL_AREA_LIST,
|
||||
data: requestParam
|
||||
}, 'getDistrictByCityId'))
|
||||
};
|
||||
calculateDistance(options) {
|
||||
var that = this;
|
||||
options = options || {};
|
||||
Utils.polyfillParam(options);
|
||||
if (Utils.checkParamKeyEmpty(options, 'to')) {
|
||||
return
|
||||
}
|
||||
var requestParam = {
|
||||
mode: options.mode || 'walking',
|
||||
to: Utils.location2query(options.to),
|
||||
output: 'json',
|
||||
key: that.key
|
||||
};
|
||||
if (options.from) {
|
||||
options.location = options.from
|
||||
}
|
||||
if (requestParam.mode == 'straight') {
|
||||
var locationsuccess = function(result) {
|
||||
var locationTo = Utils.getEndLocation(requestParam.to);
|
||||
var data = {
|
||||
message: "query ok",
|
||||
result: {
|
||||
elements: []
|
||||
},
|
||||
status: 0
|
||||
};
|
||||
for (var i = 0; i < locationTo.length; i++) {
|
||||
data.result.elements.push({
|
||||
distance: Utils.getDistance(result.latitude, result.longitude, locationTo[i]
|
||||
.lat, locationTo[i].lng),
|
||||
duration: 0,
|
||||
from: {
|
||||
lat: result.latitude,
|
||||
lng: result.longitude
|
||||
},
|
||||
to: {
|
||||
lat: locationTo[i].lat,
|
||||
lng: locationTo[i].lng
|
||||
}
|
||||
})
|
||||
}
|
||||
var calculateResult = data.result.elements;
|
||||
var distanceResult = [];
|
||||
for (var i = 0; i < calculateResult.length; i++) {
|
||||
distanceResult.push(calculateResult[i].distance)
|
||||
}
|
||||
return options.success(data, {
|
||||
calculateResult: calculateResult,
|
||||
distanceResult: distanceResult
|
||||
})
|
||||
};
|
||||
Utils.locationProcess(options, locationsuccess)
|
||||
} else {
|
||||
var locationsuccess = function(result) {
|
||||
requestParam.from = result.latitude + ',' + result.longitude;
|
||||
if (options.sig) {
|
||||
requestParam.sig = Utils.getSig(requestParam, options.sig, 'calculateDistance')
|
||||
}
|
||||
wx.request(Utils.buildWxRequestConfig(options, {
|
||||
url: URL_DISTANCE,
|
||||
data: requestParam
|
||||
}, 'calculateDistance'))
|
||||
};
|
||||
Utils.locationProcess(options, locationsuccess)
|
||||
}
|
||||
};
|
||||
direction(options) {
|
||||
var that = this;
|
||||
options = options || {};
|
||||
Utils.polyfillParam(options);
|
||||
if (Utils.checkParamKeyEmpty(options, 'to')) {
|
||||
return
|
||||
}
|
||||
var requestParam = {
|
||||
output: 'json',
|
||||
key: that.key
|
||||
};
|
||||
if (typeof options.to == 'string') {
|
||||
requestParam.to = options.to
|
||||
} else {
|
||||
requestParam.to = options.to.latitude + ',' + options.to.longitude
|
||||
}
|
||||
var SET_URL_DIRECTION = null;
|
||||
options.mode = options.mode || MODE.driving;
|
||||
SET_URL_DIRECTION = URL_DIRECTION + options.mode;
|
||||
if (options.from) {
|
||||
options.location = options.from
|
||||
}
|
||||
if (options.mode == MODE.driving) {
|
||||
if (options.from_poi) {
|
||||
requestParam.from_poi = options.from_poi
|
||||
}
|
||||
if (options.heading) {
|
||||
requestParam.heading = options.heading
|
||||
}
|
||||
if (options.speed) {
|
||||
requestParam.speed = options.speed
|
||||
}
|
||||
if (options.accuracy) {
|
||||
requestParam.accuracy = options.accuracy
|
||||
}
|
||||
if (options.road_type) {
|
||||
requestParam.road_type = options.road_type
|
||||
}
|
||||
if (options.to_poi) {
|
||||
requestParam.to_poi = options.to_poi
|
||||
}
|
||||
if (options.from_track) {
|
||||
requestParam.from_track = options.from_track
|
||||
}
|
||||
if (options.waypoints) {
|
||||
requestParam.waypoints = options.waypoints
|
||||
}
|
||||
if (options.policy) {
|
||||
requestParam.policy = options.policy
|
||||
}
|
||||
if (options.plate_number) {
|
||||
requestParam.plate_number = options.plate_number
|
||||
}
|
||||
}
|
||||
if (options.mode == MODE.transit) {
|
||||
if (options.departure_time) {
|
||||
requestParam.departure_time = options.departure_time
|
||||
}
|
||||
if (options.policy) {
|
||||
requestParam.policy = options.policy
|
||||
}
|
||||
}
|
||||
var locationsuccess = function(result) {
|
||||
requestParam.from = result.latitude + ',' + result.longitude;
|
||||
if (options.sig) {
|
||||
requestParam.sig = Utils.getSig(requestParam, options.sig, 'direction', options.mode)
|
||||
}
|
||||
wx.request(Utils.buildWxRequestConfig(options, {
|
||||
url: SET_URL_DIRECTION,
|
||||
data: requestParam
|
||||
}, 'direction'))
|
||||
};
|
||||
Utils.locationProcess(options, locationsuccess)
|
||||
}
|
||||
};
|
||||
module.exports = QQMapWX;
|
|
@ -6,4 +6,24 @@ export function uploadImg(data) {
|
|||
// 解决方案列表接口
|
||||
export function getPlanType(data) {
|
||||
return request.get("/universal/api.solution/solution_list", data);
|
||||
}
|
||||
|
||||
// 更新用户地理位置
|
||||
export function renewLocation(data) {
|
||||
return request.post("/universal/api.user/update_location", data);
|
||||
}
|
||||
|
||||
// 搜索客户、项目、备品
|
||||
export function queryFun(data) {
|
||||
return request.post("/universal/api.search/search", data);
|
||||
}
|
||||
|
||||
|
||||
// 处理工单,获取
|
||||
export function handleWorkOrderGet(data) {
|
||||
return request.get("/universal/api.order/process_order", data);
|
||||
}
|
||||
// 处理工单,提交
|
||||
export function handleWorkOrderSubmit(data) {
|
||||
return request.post("/universal/api.order/process_order", data);
|
||||
}
|
282
jsFile/tools.js
282
jsFile/tools.js
|
@ -1,5 +1,213 @@
|
|||
const app = getApp();
|
||||
import { renewLocation } from './public-api.js';
|
||||
// 解决微信小程序
|
||||
var QQMapWX = require('./map/qqmap-wx-jssdk.min.js');
|
||||
var qqmapsdk = new QQMapWX({
|
||||
key: 'QNHBZ-55RKF-OMFJJ-NPU7O-EPSDH-ACBAA'
|
||||
});
|
||||
// 解决H5跨域
|
||||
const jsonp = function(url, data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 1.初始化url
|
||||
let dataString = url.indexOf('?') === -1 ? '?' : '&'
|
||||
let callbackName = `jsonpCB_${ Date.now() }`;
|
||||
url += `${ dataString }callback=${ callbackName }`
|
||||
if(data) {
|
||||
// 2.有请求参数,依次添加到url
|
||||
for(let k in data) {
|
||||
url += `&${ k }=${ data[k] }`
|
||||
}
|
||||
}
|
||||
let scriptNode = document.createElement('script');
|
||||
scriptNode.src = url;
|
||||
// 3. callback
|
||||
window[callbackName] = (result) => {
|
||||
result ? resolve(result) : reject('没有返回数据');
|
||||
delete window[callbackName];
|
||||
document.body.removeChild(scriptNode);
|
||||
}
|
||||
// 4. 异常情况
|
||||
scriptNode.addEventListener('error', () => {
|
||||
reject('接口返回数据失败');
|
||||
delete window[callbackName];
|
||||
document.body.removeChild(scriptNode);
|
||||
}, false)
|
||||
// 5. 开始请求
|
||||
document.body.appendChild(scriptNode)
|
||||
})
|
||||
}
|
||||
const tools = {
|
||||
// 更新用户地理位置
|
||||
locationTimer:null,
|
||||
// 每十分钟调用一次
|
||||
renewLocationEv(){
|
||||
this.platformEv();
|
||||
clearInterval(this.locationTimer);
|
||||
this.locationTimer = setInterval(()=>{
|
||||
this.platformEv();
|
||||
},600000)
|
||||
},
|
||||
// 平台判断
|
||||
platformEv(){
|
||||
// #ifdef APP-PLUS
|
||||
this.getAddress();
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
this.getAddressWx();
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
this.getAddressH5();
|
||||
// #endif
|
||||
},
|
||||
// app获取经纬度和详细地址
|
||||
getAddress(){
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
geocode:true,
|
||||
success: (res)=> {
|
||||
// console.log(res,'地址信息');
|
||||
let params = {
|
||||
latitude:res.latitude,
|
||||
longitude:res.longitude,
|
||||
address:`${res.address.province}${res.address.city}${res.address.district || ''}${res.address.street || ''}${res.address.streetNum || ''}${res.address.poiName || ''}`
|
||||
}
|
||||
console.log(params,'APP');
|
||||
this.renewAddressApi(params);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 微信获取经纬度和详细地址
|
||||
getAddressWx(){
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
geocode:true,
|
||||
success: (res)=> {
|
||||
// console.log(res,'地址信息');
|
||||
qqmapsdk.reverseGeocoder({
|
||||
location: {latitude: res.latitude, longitude: res.longitude},
|
||||
success:(res)=> {
|
||||
// console.log(res,'WX');
|
||||
let params = {
|
||||
latitude:res.result.location.lat,
|
||||
longitude:res.result.location.lng,
|
||||
address:`${res.result.address}`
|
||||
}
|
||||
console.log(params,'WX');
|
||||
this.renewAddressApi(params);
|
||||
},
|
||||
fail(err) {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
// h5
|
||||
getAddressH5(){
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: (res)=> {
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask:true
|
||||
});
|
||||
let str = `output=jsonp&key=QNHBZ-55RKF-OMFJJ-NPU7O-EPSDH-ACBAA&location=${res.latitude},${res.longitude}`
|
||||
jsonp('https://apis.map.qq.com/ws/geocoder/v1/?'+str,{}).then(res=>{
|
||||
// console.log(res,'H5');
|
||||
uni.hideLoading();
|
||||
if(res.status == 0){
|
||||
// that.locationName = res.result.address; //当前定位
|
||||
let params = {
|
||||
latitude:res.result.location.lat,
|
||||
longitude:res.result.location.lng,
|
||||
address:`${res.result.address}`
|
||||
}
|
||||
console.log(params,'H5');
|
||||
this.renewAddressApi(params);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
// 更新地址事件
|
||||
renewAddressApi(params){
|
||||
console.log(params,'最终提交参数');
|
||||
// renewLocation(params).then(res=>{})
|
||||
},
|
||||
// 刷新token
|
||||
refreshToken(){
|
||||
console.log('进入检测token是否过期');
|
||||
var date = new Date();
|
||||
var timestamp = date.getTime();//精确到毫秒
|
||||
// 如果过期时间 减 10分钟 小于当前时间,刷新token
|
||||
if((uni.getStorageSync('expire')*1000 - 600000) < timestamp) {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {code:res.code}
|
||||
uni.request({
|
||||
url: `${app.globalData.hostapi}/api/user/login`,
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
|
||||
},
|
||||
success: res => {
|
||||
if(res.data.data.token!=''){
|
||||
uni.setStorageSync('token',res.data.data.token)//缓存token
|
||||
uni.setStorageSync('openid',res.data.data.openid)//缓存Openid
|
||||
uni.setStorageSync('expire',res.data.data.expire)//缓存失效时间(时间戳格式)
|
||||
uni.setStorageSync('is_active',res.data.data.is_active)//是否第一次授权
|
||||
uni.setStorageSync('phone_active',res.data.data.phone_active)//是否绑定手机号
|
||||
uni.setStorageSync('userId',res.data.data.account_id)//用户id
|
||||
uni.setStorageSync('invite_code',res.data.data.invite_code)//邀请码
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
// 判断是否授权,没授权,前往登录页面授权
|
||||
authTimer:null,
|
||||
judgeAuth(){
|
||||
let auth = false;
|
||||
clearTimeout(this.authTimer);
|
||||
if(!uni.getStorageSync('token')) {
|
||||
this.showToast('请登录');
|
||||
this.authTimer = setTimeout(()=>{
|
||||
uni.navigateTo({url:'/pages/login/login'});
|
||||
},2000)
|
||||
} else {
|
||||
auth = true;
|
||||
}
|
||||
return auth;
|
||||
},
|
||||
// 判断当前环境、清空日志、设置全局域名
|
||||
currentContext(){
|
||||
// #ifdef APP-PLUS
|
||||
if(uni.getSystemInfoSync().platform != "devtools"){//devtools:开发版 值域为:ios、android、mac(3.1.10+)、windows(3.1.10+)、linux(3.1.10+)
|
||||
// console.log = () =>{}
|
||||
}
|
||||
// #endif
|
||||
// 微信小程序原生API性能优化
|
||||
// #ifdef MP-WEIXIN
|
||||
let hInfo = wx.getAccountInfoSync();
|
||||
// console.log(hInfo.envVersion);//develop:开发版 trial:体验版 release:正式版
|
||||
// if(hInfo.miniProgram.envVersion == "develop"){
|
||||
if(hInfo.miniProgram.envVersion == "develop" || hInfo.miniProgram.envVersion == "trial"){
|
||||
|
||||
} else {
|
||||
// 清除所有输出日志
|
||||
console.log = () =>{};
|
||||
// 开启埋点倒计时
|
||||
this.daoTime();//开启埋点倒计时
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
timer:'',
|
||||
timerNot:'',
|
||||
// 埋点倒计时
|
||||
|
@ -501,80 +709,6 @@ const tools = {
|
|||
}
|
||||
return newTime;
|
||||
},
|
||||
// 刷新token
|
||||
refreshToken(){
|
||||
console.log('进入检测token是否过期');
|
||||
var date = new Date();
|
||||
var timestamp = date.getTime();//精确到毫秒
|
||||
// 如果过期时间 减 10分钟 小于当前时间,刷新token
|
||||
if((uni.getStorageSync('expire')*1000 - 600000) < timestamp) {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {code:res.code}
|
||||
uni.request({
|
||||
url: `${app.globalData.hostapi}/api/user/login`,
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
|
||||
},
|
||||
success: res => {
|
||||
if(res.data.data.token!=''){
|
||||
uni.setStorageSync('token',res.data.data.token)//缓存token
|
||||
uni.setStorageSync('openid',res.data.data.openid)//缓存Openid
|
||||
uni.setStorageSync('expire',res.data.data.expire)//缓存失效时间(时间戳格式)
|
||||
uni.setStorageSync('is_active',res.data.data.is_active)//是否第一次授权
|
||||
uni.setStorageSync('phone_active',res.data.data.phone_active)//是否绑定手机号
|
||||
uni.setStorageSync('userId',res.data.data.account_id)//用户id
|
||||
uni.setStorageSync('invite_code',res.data.data.invite_code)//邀请码
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
// 判断是否授权,没授权,前往登录页面授权
|
||||
authTimer:null,
|
||||
judgeAuth(){
|
||||
let auth = false;
|
||||
clearTimeout(this.authTimer);
|
||||
if(!uni.getStorageSync('token')) {
|
||||
this.showToast('请登录');
|
||||
this.authTimer = setTimeout(()=>{
|
||||
uni.navigateTo({url:'/pages/login/login'});
|
||||
},2000)
|
||||
} else {
|
||||
auth = true;
|
||||
}
|
||||
return auth;
|
||||
},
|
||||
// 判断当前环境、清空日志、设置全局域名
|
||||
currentContext(){
|
||||
// #ifdef APP-PLUS
|
||||
if(uni.getSystemInfoSync().platform != "devtools"){//devtools:开发版 值域为:ios、android、mac(3.1.10+)、windows(3.1.10+)、linux(3.1.10+)
|
||||
// console.log = () =>{}
|
||||
}
|
||||
// #endif
|
||||
// 微信小程序原生API性能优化
|
||||
// #ifdef MP-WEIXIN
|
||||
let hInfo = wx.getAccountInfoSync();
|
||||
// console.log(hInfo.envVersion);//develop:开发版 trial:体验版 release:正式版
|
||||
// if(hInfo.miniProgram.envVersion == "develop"){
|
||||
if(hInfo.miniProgram.envVersion == "develop" || hInfo.miniProgram.envVersion == "trial"){
|
||||
|
||||
} else {
|
||||
// 清除所有输出日志
|
||||
console.log = () =>{};
|
||||
// 开启埋点倒计时
|
||||
this.daoTime();//开启埋点倒计时
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
// 禁止小程序使用分享
|
||||
disableShareEv(){
|
||||
// #ifdef MP-WEIXIN
|
||||
|
|
|
@ -39,7 +39,11 @@
|
|||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
"ios" : {},
|
||||
"ios" : {
|
||||
"privacyDescription" : {
|
||||
"NSLocationWhenInUseUsageDescription" : ""
|
||||
}
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"sdkConfigs" : {
|
||||
"maps" : {
|
||||
|
@ -57,6 +61,9 @@
|
|||
},
|
||||
"push" : {},
|
||||
"geolocation" : {
|
||||
"system" : {
|
||||
"__platform__" : [ "ios", "android" ]
|
||||
},
|
||||
"baidu" : {
|
||||
"__platform__" : [ "ios", "android" ],
|
||||
"appkey_ios" : "",
|
||||
|
@ -103,12 +110,14 @@
|
|||
"sdkConfigs" : {
|
||||
"maps" : {
|
||||
"qqmap" : {
|
||||
"key" : "TMWBZ-XA3CD-HA74Y-PNUS4-SAV6Q-X7FXH"
|
||||
"key" : "QNHBZ-55RKF-OMFJJ-NPU7O-EPSDH-ACBAA"
|
||||
}
|
||||
}
|
||||
},
|
||||
"devServer" : {
|
||||
"https" : false,
|
||||
"port" : 8080,
|
||||
"disableHostCheck" : true,
|
||||
"proxy" : {
|
||||
"/web" : {
|
||||
"target" : "https://7and5.cn",
|
||||
|
|
|
@ -31,11 +31,18 @@
|
|||
<input class="input" type="text" v-model="data.brand" value="" placeholder="请输入品牌" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">
|
||||
<view class="title flexs">
|
||||
<text class="cor">*</text>产品尺寸
|
||||
</view>
|
||||
<input class="input" type="text" v-model="data.width" placeholder="请填写产品尺寸 宽" />
|
||||
<input class="input" type="text" v-model="data.height" placeholder="请填写产品尺寸 高" />
|
||||
<view class="disac fon26">
|
||||
<view class="disac">
|
||||
宽:<input class="input" style="width: 100rpx;" type="digit" v-model="data.width" placeholder="38.5" />
|
||||
</view>
|
||||
<view class="mar-y40 mar-z10">x</view>
|
||||
<view class="disac">
|
||||
高:<input class="input" style="width: 100%;" type="digit" v-model="data.height" placeholder="14.5" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="supplementTitle">补充信息</view>
|
||||
|
@ -67,16 +74,16 @@
|
|||
<textarea class="textarea" v-model="data.addres" placeholder="请输入详细地址" />
|
||||
</view>
|
||||
|
||||
<view class="scene-img">
|
||||
<view class="title">现场图片</view>
|
||||
<view class="img-content">
|
||||
<image v-for="(item,index) in imgsrcArr" class="img" :src="item" :key="index"
|
||||
mode="aspectFill"></image>
|
||||
|
||||
</view>
|
||||
<view class="iocn-content" @click="chooseImg()">
|
||||
<image class="icon" src="../../static/iocn/jia.png" mode=""></image>
|
||||
</view>
|
||||
<view class="scene-img dis">
|
||||
<view class="title flexs">现场图片</view>
|
||||
<view class="disac fw">
|
||||
<view class="img-content" v-for="(item,index) in imgsrcArr" :key="index">
|
||||
<image class="img mar-x10" :src="item" mode="aspectFill" lazy-load></image>
|
||||
</view>
|
||||
<view class="iocn-content flexs mar-x10" @click="chooseImg()">
|
||||
<image class="icon" src="../../static/iocn/jia.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button class="submit-button" @click="submitData()" type="default">确认提交</button>
|
||||
|
@ -106,36 +113,21 @@
|
|||
return {
|
||||
data: {
|
||||
type_id: 1,
|
||||
title: "广场大屏显示器",
|
||||
brand: "苹果",
|
||||
model: "IP445152",
|
||||
width: 100,
|
||||
height: 100,
|
||||
contact_name: "张某",
|
||||
contact_phone: "17552525252",
|
||||
title: "",
|
||||
brand: "",
|
||||
model: "",
|
||||
width: '',
|
||||
height: '',
|
||||
contact_name: "",
|
||||
contact_phone: "",
|
||||
appointment_time: '',
|
||||
addres: "上海市闵行区莘浜路421号",
|
||||
pictures: "",
|
||||
addres: "",
|
||||
pictures:''
|
||||
},
|
||||
pictures: [],
|
||||
imgsrcArr: [],
|
||||
typeIndex: 0,
|
||||
typeData: [{
|
||||
title: '巡检',
|
||||
state: false
|
||||
},
|
||||
{
|
||||
title: '保养',
|
||||
state: false
|
||||
},
|
||||
{
|
||||
title: '移屏',
|
||||
state: false
|
||||
},
|
||||
{
|
||||
title: '拆屏',
|
||||
state: false
|
||||
},
|
||||
]
|
||||
typeData: []
|
||||
}
|
||||
},
|
||||
onLoad(op) {
|
||||
|
@ -146,13 +138,12 @@
|
|||
// 切换类型
|
||||
typeIndexFun(index) {
|
||||
this.typeIndex = index
|
||||
this.data.type_id = this.typeData
|
||||
this.data.type_id = this.typeData[index].id;
|
||||
},
|
||||
getType() {
|
||||
this.$requst.post('/universal/api.vas/vas_type', this.data).then(res => {
|
||||
if (res.code == 1) {
|
||||
this.typeData = [...res.data]
|
||||
console.log(this.typeData)
|
||||
} else {
|
||||
|
||||
}
|
||||
|
@ -164,7 +155,6 @@
|
|||
// 获取预约时间
|
||||
handleSubmit(e) {
|
||||
// {year: "2019", month: "07", day: "17", hour: "15", minute: "21"}
|
||||
console.log(e)
|
||||
this.data.appointment_time = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`;
|
||||
|
||||
|
||||
|
@ -175,7 +165,6 @@
|
|||
count: 2,
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
this.imgsrcArr = []
|
||||
let imgsrc = res.tempFilePaths;
|
||||
imgsrc.forEach(item => {
|
||||
this.imgsrcArr.push(item);
|
||||
|
@ -186,11 +175,7 @@
|
|||
}).then(res => {
|
||||
if (res.code) {
|
||||
this.$toolAll.tools.showToast('上传成功');
|
||||
if (!this.data.pictures) {
|
||||
this.data.pictures = res.data.id + ","
|
||||
} else {
|
||||
this.data.pictures += res.data.id
|
||||
}
|
||||
this.pictures.push(res.data.id);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -199,6 +184,8 @@
|
|||
},
|
||||
// 提交
|
||||
submitData() {
|
||||
this.data.pictures = this.pictures.join(',');
|
||||
console.log(this.data.pictures);
|
||||
if (!this.data.title) {
|
||||
this.$toolAll.tools.showToast("请填写产品名称");
|
||||
return
|
||||
|
@ -222,17 +209,18 @@
|
|||
this.$toolAll.tools.showToast("请正确填写详细地址");
|
||||
return
|
||||
}
|
||||
if (!this.data.pictures) {
|
||||
if (!this.pictures.length) {
|
||||
this.$toolAll.tools.showToast("请选择现场图片");
|
||||
return
|
||||
}
|
||||
console.log(this.data.appointment_time)
|
||||
this.data.appointment_time = new Date(this.data.appointment_time).getTime()/1000
|
||||
this.data.width=this.data.width-0
|
||||
this.data.height= this.data.height-0
|
||||
this.data.appointment_time = new Date(this.data.appointment_time).getTime()/1000;
|
||||
this.data.pictures = this.pictures.join(',');
|
||||
this.$requst.post('/universal/api.vas/vas', this.data).then(res => {
|
||||
if (res.code == 1) {
|
||||
console.log(res)
|
||||
if (res.code) {
|
||||
this.$toolAll.tools.showToast('提交成功');
|
||||
setTimeout(()=>{
|
||||
uni.navigateBack({delta:1})
|
||||
},1000)
|
||||
} else {
|
||||
|
||||
}
|
||||
|
@ -384,7 +372,6 @@
|
|||
}
|
||||
|
||||
.scene-img {
|
||||
display: flex;
|
||||
margin-top: 27rpx;
|
||||
padding-bottom: 30rpx;
|
||||
}
|
||||
|
@ -397,12 +384,13 @@
|
|||
|
||||
.scene-img .img-content .img {
|
||||
width: 170rpx;
|
||||
height: 130rpx;
|
||||
height: 135rpx;
|
||||
margin-right: 10rpx;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.scene-img .iocn-content {
|
||||
width: 135rpx;
|
||||
width: 170rpx;
|
||||
height: 135rpx;
|
||||
background-color: #DCDCDC;
|
||||
display: flex;
|
||||
|
@ -411,7 +399,6 @@
|
|||
}
|
||||
|
||||
.scene-img .iocn-content .icon {
|
||||
|
||||
width: 62rpx;
|
||||
height: 62rpx;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
<script>
|
||||
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
|
||||
import statusNav from '../../components/status-nav.vue';
|
||||
import {queryFun} from '../../jsFile/public-api.js';
|
||||
export default {
|
||||
components: {
|
||||
statusNav,
|
||||
|
@ -80,9 +81,9 @@
|
|||
],
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
console.log(option)
|
||||
console.log( option.key_word,"--------")
|
||||
onLoad(op) {
|
||||
// 调用查询客户列表事件
|
||||
this.queryFunEv();
|
||||
},
|
||||
methods: {
|
||||
// 前往客户详情
|
||||
|
@ -90,6 +91,14 @@
|
|||
uni.navigateTo({
|
||||
url:'/pages/dataQuery/details'
|
||||
})
|
||||
},
|
||||
// 查询客户列表事件
|
||||
queryFunEv(){
|
||||
queryFun({type_id:1}).then(res=>{
|
||||
if(res.code) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,8 +118,9 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
|
||||
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
|
||||
import statusNav from '../../components/status-nav.vue';
|
||||
import {queryFun} from '../../jsFile/public-api.js';
|
||||
export default {
|
||||
components: {
|
||||
statusNav,
|
||||
|
@ -130,8 +131,19 @@
|
|||
|
||||
}
|
||||
},
|
||||
onLoad(op) {
|
||||
// 调用查询客户列表事件
|
||||
this.queryFunEv();
|
||||
},
|
||||
methods: {
|
||||
|
||||
// 查询客户列表事件
|
||||
queryFunEv(){
|
||||
queryFun({type_id:3}).then(res=>{
|
||||
if(res.code) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -39,10 +39,11 @@
|
|||
|
||||
<script>
|
||||
import statusNav from '../../components/status-nav.vue';
|
||||
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
|
||||
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
|
||||
import {queryFun} from '../../jsFile/public-api.js';
|
||||
export default {
|
||||
components:{
|
||||
containerSubgroupTwo,
|
||||
containerSubgroupTwo,
|
||||
statusNav
|
||||
},
|
||||
data() {
|
||||
|
@ -117,20 +118,23 @@
|
|||
],
|
||||
}
|
||||
},
|
||||
onLoad(op) {
|
||||
// 调用查询客户列表事件
|
||||
this.queryFunEv();
|
||||
},
|
||||
methods: {
|
||||
projectDetailsFun(){
|
||||
uni.navigateTo({
|
||||
url:"/pages/dataQuery/projectDetails"
|
||||
})
|
||||
},
|
||||
// 获取列表数据
|
||||
getData(){
|
||||
this.$requst.get('', {
|
||||
page: dataPage.page,
|
||||
list_rows:dataPage.list_rows
|
||||
}).then(res => {
|
||||
|
||||
})
|
||||
// 查询客户列表事件
|
||||
queryFunEv(){
|
||||
queryFun({type_id:2}).then(res=>{
|
||||
if(res.code) {
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
bindPickerChange(data){
|
||||
console.log(data)
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="imgJCon">
|
||||
<image class="imgJ" src="../../static/iocn/jh.png" mode=""></image>
|
||||
</view>
|
||||
|
@ -194,7 +192,7 @@
|
|||
]
|
||||
|
||||
uni.navigateTo({
|
||||
url: `${urls[index]}?key_word='${this.key_word}'`
|
||||
url: `${urls[index]}?key_word=${this.key_word}`
|
||||
})
|
||||
},
|
||||
// 最近查询跳转
|
||||
|
|
|
@ -80,7 +80,6 @@
|
|||
username: "",
|
||||
fault_picture: "",
|
||||
fault_describe: "",
|
||||
images: "",
|
||||
phone: "",
|
||||
visit_time: ""
|
||||
},
|
||||
|
@ -142,7 +141,6 @@
|
|||
this.imgsrcArr = []
|
||||
let imgsrc = res.tempFilePaths;
|
||||
imgsrc.forEach(item => {
|
||||
this.data.images = item
|
||||
this.imgsrcArr.push(item);
|
||||
})
|
||||
|
||||
|
|
|
@ -28,16 +28,16 @@
|
|||
<view class="disjbac" style="padding: 60rpx 80rpx 60rpx 60rpx;">
|
||||
<view class="disac">
|
||||
<!-- 用户头像 -->
|
||||
<image class="flexs mar-y10 radius_100" @tap="replaceImg" :src="userInfo.avatar || '/static/public/icon-my-headimg.png'" mode="aspectFill" style="width: 91rpx;height: 91rpx;" lazy-load></image>
|
||||
<image class="flexs mar-y10 radius_100" @tap="replaceImg" :src="userHeadImg || '/static/public/icon-my-headimg.png'" mode="aspectFill" style="width: 91rpx;height: 91rpx;" lazy-load></image>
|
||||
<view class="disjb fc" style="height: 91rpx;">
|
||||
<!-- 用户手机号 -->
|
||||
<view class="fon34 bold">{{tel(userInfo.username)}}</view>
|
||||
<!-- 是否实名认证 -->
|
||||
<view class="fon22" style="color: #717171;">未实名认证</view>
|
||||
<view class="fon22" style="color: #717171;">{{ifAuthentication ? '已认证' : '未实名认证'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 等级图标 -->
|
||||
<image src="/static/public/icon-my-level.png" mode="aspectFill"
|
||||
<image v-if="ifAuthentication" src="/static/public/icon-my-level.png" mode="aspectFill"
|
||||
style="width: 49rpx;height: 76rpx;" lazy-load></image>
|
||||
</view>
|
||||
<!-- 信用分、项目数量、未评价 -->
|
||||
|
@ -159,12 +159,16 @@
|
|||
title: '设置'
|
||||
},
|
||||
],
|
||||
userInfo: {}
|
||||
userInfo: {},
|
||||
ifAuthentication:false,//是否认证
|
||||
userHeadImg:''//用户头像
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
// 查询用户信息
|
||||
this.checkInfo();
|
||||
if(this.userHeadImg=='') {
|
||||
// 查询用户信息
|
||||
this.checkInfo();
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
let navHeight = uni.getSystemInfoSync().statusBarHeight + 50;
|
||||
|
@ -186,8 +190,8 @@
|
|||
count: 1,
|
||||
sourceType:['album','camera'],
|
||||
success: (res) => {
|
||||
this.userInfo.avatar = res.tempFilePaths[0];
|
||||
// this.$requst.upload('/universal/api.user/avatar',{path:this.userInfo.avatar}).then(res=>{
|
||||
this.userHeadImg = res.tempFilePaths[0];
|
||||
// this.$requst.upload('/universal/api.user/avatar',{path:this.userHeadImg}).then(res=>{
|
||||
// if(res.code) {
|
||||
// // 查询用户信息
|
||||
// this.checkInfo();
|
||||
|
@ -225,9 +229,10 @@
|
|||
this.headList[0].num = this.userInfo.credit
|
||||
this.headList[1].num = this.userInfo.project_number
|
||||
this.headList[2].num = this.userInfo.evaluate
|
||||
this.percentageList[0].num= this.userInfo.reserve_rate-0
|
||||
this.percentageList[0].num= this.userInfo.reserve_rate-0
|
||||
this.percentageList[1].num= this.userInfo.visit_rate-0
|
||||
this.percentageList[2].num= this.userInfo.repair_rate-0
|
||||
this.percentageList[2].num= this.userInfo.repair_rate-0
|
||||
this.userHeadImg = this.userInfo.avatar;
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<view slot="leftContent" @tap="goMessage" style="width: 70px;">
|
||||
<view class="home-message-box posir disac">
|
||||
<image src="/static/public/icon-home-message.png" mode=""></image>
|
||||
<view v-if="messageNumber!=0">{{messageNumber}}</view>
|
||||
<view v-if="messageNumber">{{messageNumber}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view slot="centerContent" class="disjcac">
|
||||
|
@ -37,12 +37,12 @@
|
|||
<view class="disjcac pad-sx20 bbot">
|
||||
<view class="disjcac fc width50">
|
||||
<view class="fon26 col9">项目总数</view>
|
||||
<view class="fon60 bold">126</view>
|
||||
<view class="fon60 bold">{{project_count || 0}}</view>
|
||||
</view>
|
||||
<view class="bleft" style="height: 90rpx;"></view>
|
||||
<view class="disjcac fc width50">
|
||||
<view class="fon26 col9">实时工单</view>
|
||||
<view class="fon60 bold">116</view>
|
||||
<view class="fon60 bold">{{fault_count || 0}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="disac pad-s30 pad-x10">
|
||||
|
@ -249,7 +249,7 @@
|
|||
role: 2, // 1:业务员 2:表示客户 3:表示客服 4:表示工程师
|
||||
role: uni.getStorageSync('type_id'), // 1:业务员 2:表示客户 3:表示客服 4:表示工程师
|
||||
statusHeight: uni.getSystemInfoSync().statusBarHeight + 50,
|
||||
messageNumber: 16 ,// 消息数量
|
||||
messageNumber: 0 ,// 消息数量
|
||||
noticeList:[{id:1,title:'2021年11月06日公司团建,维保服务暂停一天服务暂停一天服务暂停一天。一天服务暂停一天服务暂停一天。'}],//公告
|
||||
// 故障报修
|
||||
repairList:[
|
||||
|
@ -317,8 +317,16 @@
|
|||
],
|
||||
// 常见故障
|
||||
faultsList:[],
|
||||
locationstr:'',
|
||||
contactPhone:'',//客服联系电话
|
||||
project_count:0,//项目数量
|
||||
fault_count:0,//实时工单数量
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
// 调用首页信息查询事件
|
||||
this.checkHome();
|
||||
},
|
||||
onLoad(options) {
|
||||
// 获取当前页面url
|
||||
this.$toolAll.tools.obtainUrl();
|
||||
|
@ -328,8 +336,30 @@
|
|||
this.getIncrementServiceType();
|
||||
// 调用获取常见故障列表事件
|
||||
this.getFaultsList();
|
||||
|
||||
},
|
||||
methods: {
|
||||
// 首页信息查询
|
||||
checkHome(){
|
||||
this.$requst.get('/universal/api.home/home').then(res=>{
|
||||
if(res.code) {
|
||||
let homeObj = res.data;
|
||||
this.messageNumber = homeObj.message;//消息数量
|
||||
this.contactPhone = homeObj.contact;//客服联系电话
|
||||
this.project_count = homeObj.project_count;//项目数量
|
||||
this.fault_count = homeObj.fault_count;//实时工单数量
|
||||
if(homeObj.notice.length) {
|
||||
homeObj.notice.forEach(item=>{
|
||||
let obj = {
|
||||
id:1,
|
||||
title:`${item.name}:${item.content}`
|
||||
}
|
||||
this.noticeList.push(obj);
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
goNoticeDetail(e){
|
||||
console.log(e);
|
||||
},
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
</view>
|
||||
<swiper class="swiper" @change="swiperCurrentFun" :current="swiperCurrent"
|
||||
:style="'height:'+swiHeight+'px'">
|
||||
<!-- 基础信息 start -->
|
||||
<swiper-item>
|
||||
<view class="swiper-item uni-bg-red">
|
||||
<view id="swi1">
|
||||
|
@ -18,68 +19,68 @@
|
|||
<view class="state" :style="{backgroundColor: statusColor}">状态:{{statusText}}</view>
|
||||
<view class="li" style="margin-top: 20rpx;">
|
||||
<view class="title">工单编号:</view>
|
||||
<input type="text" disabled class="input" placeholder="" value="GD20211203-001" />
|
||||
<input type="text" disabled class="input" :value="detailObj.order_number" />
|
||||
</view>
|
||||
|
||||
<view class="li">
|
||||
<view class="title">项目编号:</view>
|
||||
<input type="text" disabled class="input" placeholder="" value="GD20211203-001" />
|
||||
<input type="text" disabled class="input" :value="detailObj.project_number" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">项目名称:</view>
|
||||
<input type="text" disabled class="input input-black" placeholder="" value="湖南省林业科学院11楼会议室P2.5" />
|
||||
<input type="text" disabled class="input input-black" :value="detailObj.project_name" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">产品类型:</view>
|
||||
<input type="text" disabled class="input" placeholder="" value="Q2.5-E" />
|
||||
<input type="text" disabled class="input" :value="detailObj.product_type" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">安装位置:</view>
|
||||
<input type="text" disabled class="input" placeholder="" value="详细地址+某某栋11楼会议室" />
|
||||
<input type="text" disabled class="input" :value="detailObj.installation_location" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">维保类型:</view>
|
||||
<input type="text" class="input" placeholder="" value="供电不足" />
|
||||
<input type="text" class="input" :value="detailObj.fault_type" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">紧急程度:</view>
|
||||
<input type="text" disabled class="input" placeholder="" value="紧急" />
|
||||
<input type="text" disabled class="input" :value="detailObj.emergency_level_view" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">维保说明:</view>
|
||||
<textarea auto-height disabled class="input"
|
||||
value="*********************************************************************************************************"
|
||||
placeholder="" />
|
||||
<textarea style="max-height: 260rpx;overflow: hidden;overflow-y: scroll;" disabled class="input" :value="detailObj.failure_description" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">维保图片:</view>
|
||||
<view class="input">
|
||||
<image class="img" src="../../static/del/img001.png" mode="aspectFill" lazy-load></image>
|
||||
<image class="img" src="../../static/del/img001.png" mode="aspectFill" lazy-load></image>
|
||||
<image class="img" v-for="(item,index) in detailObj.fault_picture" :key="index" :src="item" mode="aspectFill" lazy-load></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="work-order-from">
|
||||
<view class="li">
|
||||
<view class="title">报 单 人:</view>
|
||||
<input type="text" disabled class="input" placeholder="" value="林某" />
|
||||
<input type="text" disabled class="input" :value="detailObj.order_contact" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">报单时间:</view>
|
||||
<input type="text" disabled class="input" placeholder="" value="2021/12/3 12:00:05" />
|
||||
<input type="text" disabled class="input" :value="detailObj.order_times" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">服务方式:</view>
|
||||
<input type="text" disabled class="input input-black" placeholder="" value="上门服务" />
|
||||
<input type="text" disabled class="input input-black" :value="detailObj.service_method_view" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">定位地址:</view>
|
||||
<input type="text" disabled class="input" placeholder="" value="*******************************" />
|
||||
<input type="text" disabled class="input" :value="detailObj.service_address" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
<!-- 基础信息 end -->
|
||||
|
||||
<!-- 处理详情 start -->
|
||||
<swiper-item>
|
||||
<view class="swiper-item uni-bg-green">
|
||||
<view id="swi2">
|
||||
|
@ -87,39 +88,39 @@
|
|||
<view class="state" :style="{backgroundColor: statusColor}">状态:{{statusText}}</view>
|
||||
<view class="li" style="margin-top: 20rpx;">
|
||||
<view class="title">开始时间:</view>
|
||||
<input type="text" disabled class="input " placeholder="" value="2022-01-25 09:39" />
|
||||
<input type="text" disabled class="input " :value="handleDetail.start_times" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">结束时间:</view>
|
||||
<input type="text" disabled class="input " placeholder="" value="2022-01-25 15:30" />
|
||||
<input type="text" disabled class="input " :value="handleDetail.completion_times" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">维保用时: </view>
|
||||
<input type="text" disabled class="input input-black" placeholder="" value="5小时51分钟" />
|
||||
<input type="text" disabled class="input input-black" :value="handleDetail.maintenance_time" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">维保费用:</view>
|
||||
<input type="text" disabled class="input " placeholder="" value="¥500.00元" />
|
||||
<input type="text" disabled class="input " :value="`¥${handleDetail.pay_price}元`" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">等待时长:</view>
|
||||
<input type="text" disabled class="input " placeholder="" value="1天6小时35分钟" />
|
||||
<input type="text" disabled class="input " :value="handleDetail.waiting_time" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">主维保人:</view>
|
||||
<input type="text" disabled class="input " placeholder="" value="陈志远" />
|
||||
<input type="text" disabled class="input " :value="handleDetail.maintenance_name" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">更换配件:</view>
|
||||
<view class="rideo">
|
||||
<view class="isrideo">
|
||||
<view class="icon " :class="isrideo?'on':''">
|
||||
<view class="icon " :class="handleDetail.is_accessory == 1 ?'on':''">
|
||||
<view class="icon-content"></view>
|
||||
</view>
|
||||
<view class="fon24" style="color: #8b8b8b;">是</view>
|
||||
</view>
|
||||
<view class="isrideo">
|
||||
<view class="icon" :class="isrideo?'':'on'">
|
||||
<view class="icon" :class="handleDetail.is_accessory == 1 ?'':'on'">
|
||||
<view class="icon-content"></view>
|
||||
</view>
|
||||
<view class="fon24" style="color: #8b8b8b;">否</view>
|
||||
|
@ -128,40 +129,39 @@
|
|||
</view>
|
||||
<view class="li">
|
||||
<view class="title">工作描述:</view>
|
||||
<textarea auto-height disabled class="input "
|
||||
value="*********************************************************************************************************"
|
||||
placeholder="" />
|
||||
<textarea style="max-height: 260rpx;overflow: hidden;overflow-y: scroll;" disabled class="input " :value="handleDetail.work_explanation"/>
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">维保图片:</view>
|
||||
<view class="input add-display">
|
||||
<view class="">
|
||||
<image class="img" src="../../static/del/img001.png" mode="aspectFill" lazy-load></image>
|
||||
<image class="img" src="../../static/del/img001.png" mode="aspectFill" lazy-load></image>
|
||||
<image class="img" v-for="(item,index) in handleDetail.maintenance_pictures" :key="index" :src="item" mode="aspectFill" lazy-load></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">维保原因:</view>
|
||||
<textarea auto-height disabled class="input "
|
||||
value="*********************************************************************************************************"
|
||||
placeholder="" />
|
||||
<textarea auto-height disabled class="input " :value="handleDetail.failure_reason"/>
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">维保人员: </view>
|
||||
<input type="text" disabled class="input " placeholder="" value="罗帅 陈志远" />
|
||||
<input type="text" disabled class="input " :value="handleDetail.maintenance_more" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
<!-- 处理详情 end -->
|
||||
|
||||
|
||||
<!-- 更换配件 start -->
|
||||
<swiper-item>
|
||||
<view class="swiper-item uni-bg-blue">
|
||||
<view id="swi3">
|
||||
<view class="change-accessory">
|
||||
<view class="state" :style="{backgroundColor: statusColor}">状态:{{statusText}}</view>
|
||||
<view class="list">
|
||||
<view class="li">
|
||||
<view class="li" v-for="(item,index) in replaceParts" :key="index">
|
||||
<image class="img" src="../../static/del/img001.png" mode="aspectFill" lazy-load></image>
|
||||
<view class="text-content">
|
||||
<view class="title">
|
||||
|
@ -203,35 +203,38 @@
|
|||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
<!-- 更换配件 end -->
|
||||
|
||||
<!-- 处理过程 start -->
|
||||
<swiper-item>
|
||||
<view class="swiper-item uni-bg-blue">
|
||||
<view id="swi4">
|
||||
<view class="course-nav">
|
||||
<view class="state" :style="{backgroundColor: statusColor}">状态:{{statusText}}</view>
|
||||
<view class="date">报修时间:2022年02月10日</view>
|
||||
<view class="date">报修时间:{{handleProcess.order_times}}</view>
|
||||
<view class="code">
|
||||
<view class="">工单编号:1254635996212345</view>
|
||||
<view class="btn" @click="copy('1254635996212345')">复制</view>
|
||||
<view class="">工单编号:{{handleProcess.order_number}}</view>
|
||||
<view class="btn" @click="copy(handleProcess.order_number)">复制</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="course-content">
|
||||
<view class="record-content">
|
||||
<view class="title">过程追踪</view>
|
||||
<view class="list">
|
||||
<view class="li pad-z40 fon27 col9 pad-x20" :class="index==0 ? 'activeTrack' : ''" v-for="(item,index) in 10" :key="index">
|
||||
<view class="li pad-z40 fon27 col9 pad-x20" :class="index==0 ? 'activeTrack' : ''" v-for="(item,index) in handleProcess.time_line" :key="index">
|
||||
<view class="disac fw line-h40">
|
||||
<view class="text">“部分模组不显示”维保【陈志远】已处理。</view>
|
||||
<view class="date">2020-05-15 16:00</view>
|
||||
<view class="text">{{item.value}}</view>
|
||||
<view class="date">{{item.create_time}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="button" @tap="goEvaluate()">我要评价</view>
|
||||
</view>
|
||||
<view class="button" @tap="goEvaluate(1)">我要评价</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
<!-- 处理过程 end -->
|
||||
</swiper>
|
||||
</view>
|
||||
</container-subgroup-two>
|
||||
|
@ -243,6 +246,7 @@
|
|||
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
|
||||
import statusNav from '../../components/status-nav.vue';
|
||||
import footTabOne from "../../components/foot-tabs/foot-tab-one.vue"
|
||||
import {handleWorkOrderGet} from '../../jsFile/public-api.js';
|
||||
export default {
|
||||
components: {
|
||||
footTabOne,
|
||||
|
@ -274,7 +278,11 @@
|
|||
},
|
||||
|
||||
],
|
||||
|
||||
orderId:'',//订单id
|
||||
detailObj:{},//基础信息
|
||||
handleDetail:{},//处理详情
|
||||
replaceParts:[],//更换配件
|
||||
handleProcess:{}//处理过程
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -286,11 +294,46 @@
|
|||
|
||||
},
|
||||
onLoad(op) {
|
||||
console.log(op,333);
|
||||
this.statusText = op.statusText;
|
||||
this.statusColor = op.statusColor;
|
||||
if(op.orderId!=undefined) {
|
||||
this.orderId = op.orderId;
|
||||
// 调取获取工单详情事件
|
||||
this.getDetail(1);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取工单详情事件
|
||||
getDetail(type){
|
||||
let params = {
|
||||
order_id:this.orderId,
|
||||
type
|
||||
}
|
||||
this.$requst.get('/universal/api.order/order_info',params).then(res=>{
|
||||
if(res.code) {
|
||||
switch (type){
|
||||
case 1:
|
||||
this.detailObj = res.data;
|
||||
break;
|
||||
case 2:
|
||||
this.handleDetail = res.data;
|
||||
break;
|
||||
case 3:
|
||||
this.replaceParts = res.data.accessory;
|
||||
break;
|
||||
case 4:
|
||||
this.handleProcess = res.data;
|
||||
break;
|
||||
}
|
||||
setTimeout(()=>{
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select(`#swi${type}`).boundingClientRect(data => {
|
||||
this.swiHeight = data.height
|
||||
}).exec();
|
||||
},100)
|
||||
}
|
||||
})
|
||||
},
|
||||
isrideoFun(is) {
|
||||
this.isrideo = is
|
||||
},
|
||||
|
@ -312,37 +355,11 @@
|
|||
}
|
||||
});
|
||||
},
|
||||
|
||||
swiperCurrentFun(data) {
|
||||
|
||||
console.log(data.detail.current)
|
||||
|
||||
if (data.detail.current == 0) {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select('#swi1').boundingClientRect(data => {
|
||||
|
||||
this.swiHeight = data.height
|
||||
}).exec();
|
||||
} else if (data.detail.current == 1) {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select('#swi2').boundingClientRect(data => {
|
||||
|
||||
this.swiHeight = data.height
|
||||
}).exec();
|
||||
} else if (data.detail.current == 2) {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select('#swi3').boundingClientRect(data => {
|
||||
|
||||
this.swiHeight = data.height
|
||||
}).exec();
|
||||
} else if (data.detail.current == 3) {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select('#swi4').boundingClientRect(data => {
|
||||
|
||||
this.swiHeight = data.height
|
||||
}).exec();
|
||||
}
|
||||
this.detailsNavFun(data.detail.current)
|
||||
let current = data.detail.current;
|
||||
// 调用工单详情切换事件
|
||||
this.detailSwitch(current);
|
||||
this.detailsNavFun(current);
|
||||
},
|
||||
detailsNavFun(index) {
|
||||
for (var i = 0; i < this.detailsNav.length; i++) {
|
||||
|
@ -351,12 +368,19 @@
|
|||
this.detailsNav[index].state = true
|
||||
},
|
||||
detailsNavpa(index) {
|
||||
this.swiperCurrent = index
|
||||
this.swiperCurrent = index;
|
||||
// 调用工单详情切换事件
|
||||
this.detailSwitch(index);
|
||||
},
|
||||
// 工单详情切换事件
|
||||
detailSwitch(index){
|
||||
let type = [1,2,3,4][index];
|
||||
this.getDetail(type);
|
||||
},
|
||||
// 前往评价页面
|
||||
goEvaluate(id) {
|
||||
goEvaluate() {
|
||||
uni.navigateTo({
|
||||
url:`/pagesB/i-want-evaluate/i-want-evaluate?id=${id}`
|
||||
url:`/pagesB/i-want-evaluate/i-want-evaluate?id=${this.orderId}`
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -504,7 +528,7 @@ white-space: nowrap;
|
|||
|
||||
.course-content {
|
||||
background-color: #FFFFFF;
|
||||
padding-bottom: 60rpx;
|
||||
padding-bottom: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
|
@ -597,7 +621,7 @@ white-space: nowrap;
|
|||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
margin: auto;
|
||||
margin-top: 101rpx;
|
||||
margin-top: 50rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@
|
|||
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
|
||||
import statusNav from '../../components/status-nav.vue';
|
||||
import footTabOne from "../../components/foot-tabs/foot-tab-one.vue"
|
||||
import {handleWorkOrderGet,handleWorkOrderSubmit} from '../../jsFile/public-api.js';
|
||||
export default {
|
||||
components: {
|
||||
footTabOne,
|
||||
|
@ -131,18 +132,29 @@
|
|||
uni.removeStorageSync('targetObj');
|
||||
},
|
||||
onLoad(op) {
|
||||
this.checkInfoSignIn(op.id);
|
||||
if(op.id!=undefined) {
|
||||
this.orderId = op.id;
|
||||
this.handleWorkOrderGet(this.orderId);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 查看信息签到执行
|
||||
checkInfoSignIn(id){
|
||||
handleWorkOrderGet(id){
|
||||
let params = {
|
||||
order_id:3,
|
||||
steps:1,
|
||||
start_address:'四川省成都市成华区'
|
||||
order_id:id,
|
||||
steps:1
|
||||
}
|
||||
this.$requst.post('/universal/api.order/process_order',params).then(res=>{
|
||||
|
||||
handleWorkOrderGet(params).then(res=>{
|
||||
if(res.code) {
|
||||
let dataObj = res.data;
|
||||
this.targetObj.workOrderNo = dataObj.order_number;//工单编号
|
||||
this.targetObj.projectNo = dataObj.project_number;//项目编号
|
||||
this.targetObj.projectName = dataObj.project_name;//项目名称
|
||||
this.targetObj.urgentDegree = dataObj.emergency_level_view;//紧急程度
|
||||
this.targetObj.reporter = dataObj.order_contact;//报单人
|
||||
this.targetObj.declarationTime = dataObj.order_times;//报单时间
|
||||
this.targetObj.address = dataObj.order_times;//定位地址
|
||||
}
|
||||
})
|
||||
},
|
||||
// 上传图片
|
||||
|
@ -156,16 +168,32 @@
|
|||
}
|
||||
})
|
||||
},
|
||||
// 签到事件
|
||||
goWorkOrderThree() {
|
||||
if(this.checkEmpty()){
|
||||
if(this.flag) {
|
||||
this.flag = false;
|
||||
this.targetObj.startTime = this.$toolAll.tools.returnCurrentTime('-',0);
|
||||
uni.setStorageSync('targetObj',this.targetObj);
|
||||
uni.navigateTo({
|
||||
url: "/pages/workOrder/workorderTwo"
|
||||
let params = {
|
||||
steps:1,
|
||||
order_id:this.orderId || 14,//工单id
|
||||
start_address:'四川省成都市成华区',//开工地址
|
||||
a:this.targetObj.productType,//产品类型
|
||||
b:this.targetObj.installLocation,//安装位置
|
||||
c:this.targetObj.faultType,//维保类型
|
||||
d:this.targetObj.faultExplain,//维保说明
|
||||
e:this.targetObj.maintenanceImgList,//维保图片
|
||||
f:this.targetObj.serviceMode//服务方式
|
||||
}
|
||||
handleWorkOrderSubmit(params).then(res=>{
|
||||
if(res.code) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/workOrder/workorderTwo?id=${this.orderId}`
|
||||
})
|
||||
}
|
||||
this.flag = true;
|
||||
})
|
||||
this.flag = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -32,16 +32,16 @@
|
|||
</view>
|
||||
<view class="project-list">
|
||||
<!-- 列表循环体 -->
|
||||
<view class="li" @click="projectDetailsFun(item.order_status,item.order_id,item.attributes.text,item.attributes.color)" v-for="(item,index) in dataList" :key="index">
|
||||
<view class="li" @click="projectDetailsFun(item.order_status,item.order_id,item.btn.attributes.text,item.btn.attributes.color)" v-for="(item,index) in dataList" :key="index">
|
||||
<view class="work-order-code">工单编号:{{item.order_number}}</view>
|
||||
<view class="message">
|
||||
<image class="img" src="../../static/del/img001.png" mode="aspectFill"></image>
|
||||
<view class="text">
|
||||
<view class="title">
|
||||
<view class="text disjb fc" style="height: 180rpx;">
|
||||
<view class="title flexs">
|
||||
<view class="text clips1">{{item.project_name}}</view>
|
||||
<view class="icon" :style="{backgroundColor: item.attributes.color}">{{item.attributes.text}}</view>
|
||||
<view class="icon" :style="{backgroundColor: item.btn.attributes.color}">{{item.btn.attributes.text}}</view>
|
||||
</view>
|
||||
<view class="disjb fc" style="margin-left: -20rpx;height: 70%;">
|
||||
<view class="disjb fc line-h38" style="margin-left: -20rpx;">
|
||||
<view class="serial-number scal09">
|
||||
<view class="type">#{{item.fault_type}}#</view>
|
||||
<view class="date">{{item.failure_time}}</view>
|
||||
|
@ -175,7 +175,7 @@
|
|||
} else {
|
||||
// 客户、客服、业务员、工程师点击查看详情
|
||||
uni.navigateTo({
|
||||
url: `/pages/workOrder/details?id=${id}&status=${status}&statusText=${statusText}&statusColor=${statusColor}`
|
||||
url: `/pages/workOrder/details?orderId=${id}&status=${status}&statusText=${statusText}&statusColor=${statusColor}`
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -356,6 +356,7 @@
|
|||
border-radius: 50rpx;
|
||||
color: #FFFFFF;
|
||||
display: flex;justify-content: center;align-items: center;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.project-list .li .message .text .title .icon1 {
|
||||
|
@ -369,7 +370,6 @@
|
|||
.project-list .li .message .serial-number {
|
||||
color: #9b9ba3;
|
||||
font-size: 24rpx;
|
||||
margin-bottom: 10rpx;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
@ -380,7 +380,6 @@
|
|||
.project-list .li .message .specification {
|
||||
color: #9b9ba3;
|
||||
font-size: 24rpx;
|
||||
margin-bottom: 10rpx;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
@ -431,9 +430,6 @@
|
|||
.project-list-address .address {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 80%;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.project-list .work-order-code {
|
||||
|
|
|
@ -147,6 +147,8 @@
|
|||
import footTabOne from "../../components/foot-tabs/foot-tab-one.vue"
|
||||
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
|
||||
import {base64ToPath} from '@/jsFile/base64-src.js';
|
||||
import {handleWorkOrderGet,handleWorkOrderSubmit,uploadImg} from '../../jsFile/public-api.js';
|
||||
|
||||
var content = null;
|
||||
var touchs = [];
|
||||
var canvasw = 0;
|
||||
|
@ -174,7 +176,7 @@
|
|||
],
|
||||
currentWay:0,//结束方式类型
|
||||
signatureState:false,
|
||||
array: ['微信', '支付宝', '现金', '类型'],
|
||||
array: ['微信', '支付宝', '银行转账'],
|
||||
paymentModeIndex:0,
|
||||
serviceTime:'' ,// 服务时间
|
||||
detailObj:{
|
||||
|
@ -198,6 +200,8 @@
|
|||
remarkText:'',//备注内容
|
||||
saveTimer:null,//保存签名延迟时间事件
|
||||
flag:true,//防抖
|
||||
signId:'',//签名图片id
|
||||
orderId:''//工单id
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
|
@ -222,7 +226,7 @@
|
|||
return taxesResult;
|
||||
}
|
||||
},
|
||||
onLoad: function(options) {
|
||||
onLoad: function(op) {
|
||||
//获得Canvas的上下文
|
||||
content = uni.createCanvasContext('firstCanvas')
|
||||
//设置线的颜色
|
||||
|
@ -235,37 +239,65 @@
|
|||
content.setLineJoin('round');
|
||||
// 调用税金换算事件
|
||||
// this.conversionEv();
|
||||
if(op.id!=undefined) {
|
||||
this.orderId = op.id;
|
||||
// 调用查询结算审核信息事件
|
||||
this.handleWorkOrderGet(this.orderId);
|
||||
}
|
||||
this.handleWorkOrderGet();
|
||||
},
|
||||
methods: {
|
||||
// 查询结算审核信息
|
||||
handleWorkOrderGet(id){
|
||||
let params = {
|
||||
order_id:14,
|
||||
steps:3
|
||||
}
|
||||
handleWorkOrderGet(params).then(res=>{
|
||||
if(res.code) {
|
||||
let dataObj = res.data;
|
||||
}
|
||||
})
|
||||
},
|
||||
// 提交审核事件
|
||||
submitEv() {
|
||||
if(this.checkEmpty()) {
|
||||
if(this.flag) {
|
||||
this.flag = false;
|
||||
let params = {
|
||||
a:this.clearingForm[this.currentWay].title,
|
||||
b:this.serviceTime,
|
||||
order_id:this.orderId,
|
||||
steps:3,
|
||||
settlement_type:[1,2,3,4][this.currentWay],//结算方式1:单次收费 2:质保免费 3:验收扫尾 4:包年签单
|
||||
c:this.detailObj.doorToDoorFee,
|
||||
d:this.detailObj.taxes,
|
||||
e:this.detailObj.materialCost,
|
||||
f:this.detailObj.otherCost,
|
||||
g:this.totalPrice,
|
||||
h:this.paymentMode,
|
||||
i:this.billingIndex,
|
||||
j:this.isMoney,
|
||||
k:this.signImage,
|
||||
m:this.remarkText
|
||||
pay_type:[1,2,3][this.paymentModeIndex],//支付方式1:微信 2:支付宝 3:银行转账
|
||||
invoice_type:[3,2,1][this.billingIndex],//开票方式3:专票 2:普票 1:不开票
|
||||
is_collection:this.isMoney ? 1 : 0,//是否收款
|
||||
signature:this.signId,//签名id
|
||||
settlement_remark:this.remarkText//备注内容
|
||||
}
|
||||
console.log(params);
|
||||
handleWorkOrderSubmit(params).then(res=>{
|
||||
if(res.code) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/workOrder/workorderTwo?id=${this.orderId}`
|
||||
})
|
||||
}
|
||||
this.flag = true;
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
// 判空
|
||||
checkEmpty(){
|
||||
let result = false;
|
||||
if(!this.serviceTime) {
|
||||
this.$toolAll.tools.showToast('请选择服务时间');
|
||||
} else if(!this.paymentMode) {
|
||||
// if(!this.serviceTime) {
|
||||
// this.$toolAll.tools.showToast('请选择服务时间');
|
||||
// } else
|
||||
if(!this.paymentMode) {
|
||||
this.$toolAll.tools.showToast('请选择付款方式');
|
||||
} else if(!this.signImage) {
|
||||
this.$toolAll.tools.showToast('请签名');
|
||||
|
@ -382,7 +414,14 @@
|
|||
// base64转图片路径
|
||||
base64ToPath(res.tempFilePath).then(path => {
|
||||
that.signImage = path;
|
||||
console.log(that.signImage,308);
|
||||
console.log(that.signImage);
|
||||
uploadImg({path:that.signImage}).then(res=>{
|
||||
if(res.code) {
|
||||
that.signId = res.data.id;
|
||||
} else {
|
||||
that.$toolAll.tools.showToast(res.msg);
|
||||
}
|
||||
})
|
||||
}).catch(error => {})
|
||||
}
|
||||
})
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<textarea auto-height disabled class="input input-black" :value="targetObj.faultExplain" />
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="title">维保图片:</view>
|
||||
<view class="title">故障图片:</view>
|
||||
<view class="input add-display">
|
||||
<view class="">
|
||||
<image class="img" v-for="(item,index) in targetObj.faultImgList" :src="item" mode="aspectFill" lazy-load></image>
|
||||
|
@ -161,6 +161,7 @@
|
|||
import footTabOne from "../../components/foot-tabs/foot-tab-one.vue"
|
||||
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
|
||||
import yyMmDdHhSs from '@/components/dates/yy-mm-dd-hh-ss.vue';
|
||||
import {handleWorkOrderGet,handleWorkOrderSubmit,uploadImg} from '../../jsFile/public-api.js';
|
||||
export default {
|
||||
components: {
|
||||
footTabOne,
|
||||
|
@ -172,7 +173,8 @@
|
|||
return {
|
||||
// isrideo: true,
|
||||
accessoriesData: [],
|
||||
targetObj:''
|
||||
targetObj:'',
|
||||
temporaryImg:[]//暂存图片id
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
|
@ -190,10 +192,28 @@
|
|||
// uni.removeStorageSync('partsList')
|
||||
this.accessoriesData = uni.getStorageSync('partsList');
|
||||
},
|
||||
onLoad() {
|
||||
onLoad(op) {
|
||||
this.targetObj = uni.getStorageSync('targetObj');
|
||||
if(op.id!=undefined) {
|
||||
this.orderId = op.id;
|
||||
// 调用查询填写维保单信息
|
||||
this.handleWorkOrderGet(this.orderId);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 查询填写维保单信息
|
||||
handleWorkOrderGet(id){
|
||||
let params = {
|
||||
order_id:this.orderId,
|
||||
steps:2
|
||||
}
|
||||
handleWorkOrderGet(params).then(res=>{
|
||||
if(res.code) {
|
||||
let dataObj = res.data;
|
||||
this.targetObj.startTime = dataObj.start_times;
|
||||
}
|
||||
})
|
||||
},
|
||||
// 维保图片选择
|
||||
chooseImg(){
|
||||
uni.chooseImage({
|
||||
|
@ -202,7 +222,14 @@
|
|||
success: (res) => {
|
||||
let imgsrc = res.tempFilePaths;
|
||||
imgsrc.forEach(item=>{
|
||||
this.targetObj.maintenanceImgList.push(item);
|
||||
uploadImg({path:item}).then(res=>{
|
||||
if(res.code) {
|
||||
this.temporaryImg.push(res.data.id);
|
||||
this.targetObj.maintenanceImgList.push(item);
|
||||
} else {
|
||||
this.$toolAll.tools.showToast(res.msg);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
|
@ -210,6 +237,7 @@
|
|||
// 删除维保图片
|
||||
delImg(index) {
|
||||
this.targetObj.maintenanceImgList.splice(index,1);
|
||||
this.temporaryImg.splice(index,1);
|
||||
},
|
||||
// 更换配件切换事件
|
||||
//isrideoFun(is) {
|
||||
|
@ -217,11 +245,35 @@
|
|||
// this.targetObj.ifParts = this.isrideo;
|
||||
//},
|
||||
goWorkorderTwo(){
|
||||
console.log(this.targetObj);
|
||||
if(this.checkEmpty()) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/workOrder/workOrderThree"
|
||||
})
|
||||
let accessoryArr = [];
|
||||
if(this.accessoriesData.length) {
|
||||
this.accessoriesData.forEach(item=>{
|
||||
let obj = {
|
||||
id:item.id,
|
||||
quantity:item.num
|
||||
}
|
||||
accessoryArr.push(obj);
|
||||
})
|
||||
}
|
||||
let params = {
|
||||
order_id:this.orderId,
|
||||
steps:2,
|
||||
completion_time:this.targetObj.endTime,//结束时间
|
||||
work_explanation:this.targetObj.workDescribe,//工作描述
|
||||
failure_reason:this.targetObj.faultReason,//维保原因
|
||||
maintenance_pictures:this.temporaryImg.join(','),//维保图片
|
||||
maintenance_more:this.targetObj.maintenancePersonnel,//维保人员
|
||||
accessory:accessoryArr,//配件列表
|
||||
completion_address:'完工地址'
|
||||
}
|
||||
handleWorkOrderSubmit(params).then(res=>{
|
||||
if(res.code) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/workOrder/workOrderThree?id=${this.orderId}`
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
@ -105,27 +105,44 @@
|
|||
e_mail:'', // 电子邮箱
|
||||
id_card_no:'', // 身份证号码
|
||||
imgList:[],
|
||||
flag:true
|
||||
flag:true,
|
||||
temporaryImg:[]
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 调用获取个人信息事件
|
||||
this.getData()
|
||||
},
|
||||
methods: {
|
||||
// 获取个人信息
|
||||
getData(){
|
||||
this.$requst.get('/universal/api.user/user_info').then(res => {
|
||||
// 获取个人信息
|
||||
getData(){
|
||||
this.$requst.get('/universal/api.user/user_info').then(res => {
|
||||
if (res.code == 1 && res.data.length != 1) {
|
||||
// 我的昵称
|
||||
this.nickname=res.data.nickname;
|
||||
// 姓名
|
||||
this.full_name=res.data.name;
|
||||
// res.data.sex ==> 2:男 1:女 0:未知
|
||||
res.data.sex != 1 ? this.genderNum = 1 : this.genderNum = 2;
|
||||
this.contact_number=res.data.phone
|
||||
this.e_mail=res.data.email
|
||||
this.id_card_no=res.data.idcard
|
||||
// 联系电话
|
||||
this.contact_number=res.data.phone;
|
||||
// 电子邮箱
|
||||
this.e_mail = res.data.email;
|
||||
// 身份证号码
|
||||
this.id_card_no = res.data.idcard;
|
||||
// 身份证正面
|
||||
this.imgList[0] = res.data.idcard_front;
|
||||
// 身份证反面
|
||||
this.imgList[1] = res.data.idcard_reverse;
|
||||
// 意外险材料
|
||||
this.imgList[2] = res.data.accident_insurance;
|
||||
// 签署工程师合作协议
|
||||
this.imgList[3] = res.data.agreement_document;
|
||||
// 技能证书
|
||||
this.imgList[3] = res.data.skills_certificate;
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
// 提交保存事件
|
||||
sumbmitData(){
|
||||
if(this.checkEmpty()){
|
||||
|
@ -138,16 +155,19 @@
|
|||
phone:this.contact_number,
|
||||
email:this.e_mail,
|
||||
idcard:this.id_card_no,
|
||||
g:this.imgList[0] || '',
|
||||
accident_insurance:this.imgList[1] || '',
|
||||
agreement_document:this.imgList[2] || '',
|
||||
skills_certificate:this.imgList[3] || ''
|
||||
idcard_front:this.temporaryImg[0] || '',
|
||||
idcard_reverse:this.temporaryImg[1] || '',
|
||||
accident_insurance:this.temporaryImg[2] || '',
|
||||
agreement_document:this.temporaryImg[3] || '',
|
||||
skills_certificate:this.temporaryImg[4] || ''
|
||||
}
|
||||
|
||||
this.$requst.post('/universal/api.user/user_info',params).then(res=>{
|
||||
if(res.code==1){
|
||||
|
||||
// uni.navigateBack({delta:1})
|
||||
this.$toolAll.tools.showToast('保存成功');
|
||||
setTimeout(()=>{
|
||||
uni.navigateBack({delta:1})
|
||||
},1000)
|
||||
|
||||
}
|
||||
})
|
||||
|
@ -156,7 +176,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 判断是否为空
|
||||
checkEmpty(){
|
||||
let result = false;
|
||||
|
@ -173,12 +192,14 @@
|
|||
} else if(this.$toolAll.tools.isIdentity(this.id_card_no)) {
|
||||
this.$toolAll.tools.showToast('请正确输入身份证号码');
|
||||
} else if(!this.imgList[0]) {
|
||||
this.$toolAll.tools.showToast('请上传身份证正反面');
|
||||
this.$toolAll.tools.showToast('请上传身份证正面照');
|
||||
} else if(!this.imgList[1]) {
|
||||
this.$toolAll.tools.showToast('请上传意外险材料');
|
||||
this.$toolAll.tools.showToast('请上传身份证反面照');
|
||||
} else if(!this.imgList[2]) {
|
||||
this.$toolAll.tools.showToast('请上传合作协议');
|
||||
this.$toolAll.tools.showToast('请上传意外险材料');
|
||||
} else if(!this.imgList[3]) {
|
||||
this.$toolAll.tools.showToast('请上传合作协议');
|
||||
} else if(!this.imgList[4]) {
|
||||
this.$toolAll.tools.showToast('请上传技能证书');
|
||||
} else {
|
||||
result = true;
|
||||
|
@ -199,10 +220,11 @@
|
|||
sourceType:['album'],
|
||||
success: (res) => {
|
||||
let tempImg = res.tempFilePaths[0];
|
||||
this.imgList[index] = tempImg;
|
||||
uploadImg({path:tempImg}).then(res=>{
|
||||
if(res.code) {
|
||||
this.$toolAll.tools.showToast('上传成功');
|
||||
this.imgList[index] = tempImg;
|
||||
this.temporaryImg[index] = res.data.id;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -215,6 +237,7 @@
|
|||
this.imgList.forEach((item,index)=>{
|
||||
if(current==index) arr.push(item);
|
||||
})
|
||||
console.log(this.imgList);
|
||||
if(arr.length) {
|
||||
uni.previewImage({
|
||||
current:current,
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
<view class="bbot disac pad-sx30 pad-zy30">
|
||||
<view class="mar-y30 flexs">人员状态 <text style="color: red;">*</text></view>
|
||||
<view class="disac">
|
||||
<view @tap="chooseStatus(index,0)" v-for="(item,index) in personnelStatus" :key="index" class="service-range-status mar-y10 pad-zy20 pad-sx6" :class="statusNum==index ? 'service-range-activeStatus' : ''">{{item}}</view>
|
||||
<view @tap="chooseStatus(index,0)" v-for="(item,index) in personnelStatus" :key="index" class="service-range-status mar-y10 pad-zy20 pad-sx6" :class="statusNum==index ? 'service-range-activeStatus' : ''">{{item.title}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bbot disac pad-sx30 pad-zy30">
|
||||
<view id="timeBox" class="mar-y30 flexs">工作时段 <text style="color: red;">*</text></view>
|
||||
<view class="disac">
|
||||
<view @tap="chooseStatus(index,1)" v-for="(item,index) in workingHours" :key="index" class="service-range-status mar-y10" style="padding: 6rpx 46rpx;" :class="hoursNum==index ? 'service-range-activeStatus' : ''">{{item}}</view>
|
||||
<view @tap="chooseStatus(index,1)" v-for="(item,index) in workingHours" :key="index" class="service-range-status mar-y10" style="padding: 6rpx 46rpx;" :class="hoursNum==index ? 'service-range-activeStatus' : ''">{{item.title}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bbot disac pad-sx30 pad-zy30">
|
||||
|
@ -56,9 +56,9 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
personnelStatus:['工作状态','休息状态'],
|
||||
personnelStatus:[{id:1,title:'工作状态'},{id:0,title:'休息状态'}],
|
||||
statusNum:0,
|
||||
workingHours:['不限','白天','晚上'],
|
||||
workingHours:[{id:3,title:'不限'},{id:1,title:'白天'},{id:2,title:'晚上'}],
|
||||
hoursNum:0,
|
||||
serviceRange:['30KM','80KM','1500KM','其他','其他','其他','其他'],
|
||||
rangeNum:0,
|
||||
|
@ -91,17 +91,20 @@
|
|||
if(this.flag) {
|
||||
this.flag = false;
|
||||
let params = {
|
||||
a:this.personnelStatus[this.statusNum],
|
||||
b:this.workingHours[this.hoursNum],
|
||||
c:this.region,
|
||||
d:this.detailed_address,
|
||||
f:this.serviceRange[this.rangeNum],
|
||||
g:this.remarkText
|
||||
is_working:this.personnelStatus[this.statusNum].id,//人员状态
|
||||
working_hours:this.workingHours[this.hoursNum].id ,//工作时段
|
||||
area:this.region,//地区
|
||||
address:this.detailed_address,//详细地址
|
||||
service_distance: parseFloat(this.serviceRange[this.rangeNum]) || 0,//服务范围
|
||||
remark:this.remarkText//备注
|
||||
}
|
||||
console.log(params,87);
|
||||
// this.$requst.post().then(res=>{
|
||||
// this.$requst.post('/universal/api.user/service_area',params).then(res=>{
|
||||
// if(res.code) {
|
||||
// uni.navigateBack({delta:1})
|
||||
// this.$toolAll.tools.showToast('保存成功');
|
||||
// setTimeout(()=>{
|
||||
// uni.navigateBack({delta:1})
|
||||
// },1000)
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue