|
@@ -12,7 +12,7 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- fisadministrator: (wx.getStorageSync('userData').fisadministrator == 1) ? true : false, //是否主账号
|
|
|
+ isDisabled: false, //是否禁用
|
|
|
butText: "保存", //按钮文字
|
|
|
popups: false, //弹出层控制
|
|
|
/* */
|
|
@@ -45,33 +45,32 @@ Page({
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
- _Http.basic({
|
|
|
- "accesstoken": wx.getStorageSync('userData').token,
|
|
|
- "classname": "customer.tagents.tagents",
|
|
|
- "method": "query_enterpriseAgentsMain",
|
|
|
- "content": {}
|
|
|
- }).then(res => {
|
|
|
- const data = res.data[0];
|
|
|
- if (data.ftype == '个人' && data.fisauthenticating == 1) {
|
|
|
- wx.showToast({
|
|
|
- title: '商户信息审核中',
|
|
|
- icon: "none",
|
|
|
- duration: 5000,
|
|
|
- })
|
|
|
- this.setData({
|
|
|
- butText: "审核中",
|
|
|
- fisadministrator: false
|
|
|
- })
|
|
|
- this.returnData(data)
|
|
|
- } else if (data.ftype == '个人' && data.fisauthenticating == 0) {
|
|
|
- this.setData({
|
|
|
- requestType: "商户认证",
|
|
|
- butText: "立即认证"
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.returnData(data)
|
|
|
- };
|
|
|
- })
|
|
|
+ // 判断主子账号 是否禁用
|
|
|
+ this.setData({
|
|
|
+ isDisabled: (wx.getStorageSync('userData').fisadministrator == 1) ? false : true
|
|
|
+ });
|
|
|
+ //判断进入方式
|
|
|
+ if (options.data == null) {
|
|
|
+ console.log("注册进入")
|
|
|
+ this.setData({
|
|
|
+ requestType: "商户认证"
|
|
|
+ })
|
|
|
+ } else if (options.data == 1) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '商户信息审核中',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 5000
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ requestType: "商户认证",
|
|
|
+ isDisabled: true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ console.log("商户进入");
|
|
|
+ const data = JSON.parse(options.data);
|
|
|
+ console.log(data)
|
|
|
+ this.returnData(data)
|
|
|
+ }
|
|
|
},
|
|
|
/* 添加图片 */
|
|
|
imageChange(data) {
|
|
@@ -81,9 +80,8 @@ Page({
|
|
|
},
|
|
|
/* 选择类目回调 */
|
|
|
saleprodChange(arr) {
|
|
|
- let {
|
|
|
- detail
|
|
|
- } = arr, showSaleprodclass = "";
|
|
|
+ let detail = arr.detail,
|
|
|
+ showSaleprodclass = "";
|
|
|
for (let i = 0; i < detail.length; i++) {
|
|
|
showSaleprodclass += (detail[i] + ',');
|
|
|
};
|
|
@@ -96,23 +94,25 @@ Page({
|
|
|
/* 返回数据 */
|
|
|
returnData(data) {
|
|
|
let attinfos = [];
|
|
|
- for (let i = 0; i < data.attinfos.length; i++) {
|
|
|
- let arr = {
|
|
|
+ // 格式化图片
|
|
|
+ if (data.attinfos.length >= 1) {
|
|
|
+ const i = data.attinfos.length - 1;
|
|
|
+ attinfos = [{
|
|
|
url: data.attinfos[i].fobsurl,
|
|
|
ownerid: data.attinfos[i].ownerid,
|
|
|
tattachmentid: data.attinfos[i].tattachmentid,
|
|
|
ownertable: data.attinfos[i].ownertable,
|
|
|
fdocument: data.attinfos[i].fdocument
|
|
|
- }
|
|
|
- attinfos.push(arr)
|
|
|
- };
|
|
|
+ }]
|
|
|
+ }
|
|
|
|
|
|
//格式化经营类目
|
|
|
if (data.saleprodclass.length >= 1) {
|
|
|
this.saleprodChange({
|
|
|
- detali: data.saleprodclass
|
|
|
+ detail: data.saleprodclass
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
this.setData({
|
|
|
fbrand: data.fbrand,
|
|
|
saleprodclass: data.saleprodclass,
|
|
@@ -123,21 +123,18 @@ Page({
|
|
|
faddress: data.faddress,
|
|
|
fdutyparagraph: data.fdutyparagraph,
|
|
|
attinfos,
|
|
|
- isLogo: imageData
|
|
|
})
|
|
|
},
|
|
|
/* 提交数据 */
|
|
|
submit() {
|
|
|
- if (!this.data.fisadministrator) return wx.showToast({
|
|
|
- title: '当前无权限修改',
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
if (!this.formVerify()) return wx.showToast({
|
|
|
title: '请检查表单内容',
|
|
|
icon: "error"
|
|
|
});
|
|
|
- /* 验证附件列表 */
|
|
|
- if (!_Verify.required(this.data.isLogo, "请上传品牌logo")) return;
|
|
|
+ if (this.data.attinfos.length < 1) return wx.showToast({
|
|
|
+ title: '请上传品牌LOGO!',
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
/* 发送请求 */
|
|
|
_Http.basic({
|
|
|
"accesstoken": wx.getStorageSync('userData').token,
|
|
@@ -157,14 +154,17 @@ Page({
|
|
|
}]
|
|
|
}
|
|
|
}).then(res => {
|
|
|
- if (res.data == '成功') {
|
|
|
- wx.showToast({
|
|
|
- title: '提交成功',
|
|
|
- });
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ })
|
|
|
+ wx.showToast({
|
|
|
+ title: '提交成功',
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
wx.navigateBack({
|
|
|
delta: 1,
|
|
|
})
|
|
|
- }
|
|
|
+ }, 500)
|
|
|
})
|
|
|
},
|
|
|
/* 表单验证 */
|
|
@@ -177,7 +177,7 @@ Page({
|
|
|
verify = false;
|
|
|
}
|
|
|
/* 验证经营类目 */
|
|
|
- if (!_Verify.required(this.data.saleprodclass)) {
|
|
|
+ if (!_Verify.required(this.data.showSaleprodclass)) {
|
|
|
errTips.saleprodclass = true;
|
|
|
verify = false;
|
|
|
}
|
|
@@ -213,7 +213,7 @@ Page({
|
|
|
},
|
|
|
/* 弹出层 */
|
|
|
showPop() {
|
|
|
- if (!this.data.fisadministrator) return;
|
|
|
+ if (this.data.isDisabled) return;
|
|
|
this.setData({
|
|
|
popups: !this.data.popups
|
|
|
})
|
|
@@ -237,17 +237,17 @@ Page({
|
|
|
const {
|
|
|
value
|
|
|
} = e.detail;
|
|
|
+ let errTips = this.data.errTips;
|
|
|
/* 联系方式验证 */
|
|
|
if (name == 'fphonenumber') {
|
|
|
- _Verify.phoneNumber(this.data.fphonenumber, true)
|
|
|
+ if(!_Verify.phoneNumber(this.data.fphonenumber, true)) errTips[name] = true;
|
|
|
}
|
|
|
if (value.trim() == "") {
|
|
|
- let errTips = this.data.errTips;
|
|
|
errTips[name] = true;
|
|
|
- this.setData({
|
|
|
- errTips
|
|
|
- })
|
|
|
}
|
|
|
+ this.setData({
|
|
|
+ errTips
|
|
|
+ })
|
|
|
},
|
|
|
/* 更改logo */
|
|
|
logoChange(data) {
|