From 8f2642e155a2f90aa428d9b15ef5fd20318aedf7 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Tue, 12 Jan 2021 07:16:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=95=86=E9=93=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/property/addShops/addShops.js | 6 +- .../bindOwnerShops/bindOwnerShops.html | 53 ++++++ .../property/bindOwnerShops/bindOwnerShops.js | 179 ++++++++++++++++++ public/pages/property/shops/shops.html | 11 +- public/pages/property/shops/shops.js | 4 + public/vcCore/vcFramework.js | 26 ++- 6 files changed, 263 insertions(+), 16 deletions(-) create mode 100644 public/components/property/bindOwnerShops/bindOwnerShops.html create mode 100644 public/components/property/bindOwnerShops/bindOwnerShops.js diff --git a/public/components/property/addShops/addShops.js b/public/components/property/addShops/addShops.js index 48d01aabb..f0bee4bad 100644 --- a/public/components/property/addShops/addShops.js +++ b/public/components/property/addShops/addShops.js @@ -19,11 +19,10 @@ vc.on('addShops', 'addShopsModel', function (_params) { vc.component.refreshAddShopsInfo(); $('#addShopsModel').modal('show'); - vc.component.addShopsInfo.floorId = _params.floorId; vc.component.addShopsInfo.communityId = vc.getCurrentCommunity().communityId; }); - vc.on('addShops', 'notify', function (_param) { + vc.on('addShops', 'addShops', 'notify', function (_param) { if (_param.hasOwnProperty('floorId')) { $that.addShopsInfo.floorId = _param.floorId; } @@ -122,8 +121,7 @@ if (res.status == 200) { //关闭model $('#addShopsModel').modal('hide'); - vc.emit('room', 'loadData', { - floorId: vc.component.addShopsInfo.floorId + vc.emit('shops', 'loadData', { }); return; } diff --git a/public/components/property/bindOwnerShops/bindOwnerShops.html b/public/components/property/bindOwnerShops/bindOwnerShops.html new file mode 100644 index 000000000..b2215906c --- /dev/null +++ b/public/components/property/bindOwnerShops/bindOwnerShops.html @@ -0,0 +1,53 @@ + \ No newline at end of file diff --git a/public/components/property/bindOwnerShops/bindOwnerShops.js b/public/components/property/bindOwnerShops/bindOwnerShops.js new file mode 100644 index 000000000..2ba268dac --- /dev/null +++ b/public/components/property/bindOwnerShops/bindOwnerShops.js @@ -0,0 +1,179 @@ +(function (vc, vm) { + + vc.extends({ + data: { + bindOwnerShopsInfo: { + roomId: '', + roomNum: '', + shopsName: '', + ownerId: '', + ownerName: '', + tel: '', + startTime: '', + endTime: '', + remark: '', + communityId: '', + shopsState:'2006' + } + }, + _initMethod: function () { + + vc.initDate('hireStartTime', function (_startTime) { + $that.bindOwnerShopsInfo.startTime = _startTime; + }); + vc.initDate('hireEndTime', function (_endTime) { + $that.bindOwnerShopsInfo.endTime = _endTime; + let start = Date.parse(new Date($that.bindOwnerShopsInfo.startTime)) + let end = Date.parse(new Date($that.bindOwnerShopsInfo.endTime)) + if (start - end >= 0) { + vc.toast("结束时间必须大于开始时间") + $that.bindOwnerShopsInfo.endTime = ''; + } + }); + }, + _initEvent: function () { + vc.on('bindOwnerShops', 'bindOwnerShopsModel', function (_params) { + vc.component.refreshAddShopsInfo(); + $that.bindOwnerShopsInfo.roomId = _params.roomId; + $that.bindOwnerShopsInfo.shopsState = _params.shopsState; + $that.bindOwnerShopsInfo.shopsName = _params.floorNum + '-' + _params.roomNum; + $('#bindOwnerShopsModel').modal('show'); + vc.component.bindOwnerShopsInfo.communityId = vc.getCurrentCommunity().communityId; + }); + }, + methods: { + + bindOwnerShopsValidate: function () { + return vc.validate.validate({ + bindOwnerShopsInfo: vc.component.bindOwnerShopsInfo + }, { + 'bindOwnerShopsInfo.roomId': [ + { + limit: "required", + param: "", + errInfo: "商铺不能为空" + } + ], + 'bindOwnerShopsInfo.tel': [ + { + limit: "required", + param: "", + errInfo: "手机号不能为空" + }, + { + limit: "phone", + param: "", + errInfo: "手机号格式错误" + } + ], + 'bindOwnerShopsInfo.ownerName': [ + { + limit: "required", + param: "", + errInfo: "租户名称不能为空" + } + ], + 'bindOwnerShopsInfo.startTime': [ + { + limit: "required", + param: "", + errInfo: "起租时间不能为空" + } + ], + 'bindOwnerShopsInfo.endTime': [ + { + limit: "required", + param: "", + errInfo: "截租时间不能为空" + } + ], + 'bindOwnerShopsInfo.remark': [ + { + limit: "maxLength", + param: "200", + errInfo: "备注长度不能超过200位" + }, + ] + + }); + }, + bindOwnerShops: function () { + if (!vc.component.bindOwnerShopsValidate()) { + vc.toast(vc.validate.errInfo); + return; + } + + vc.http.apiPost( + 'room.saveOwnerShops', + JSON.stringify(vc.component.bindOwnerShopsInfo), + { + emulateJSON: true + }, + function (json, res) { + //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); + if (res.status == 200) { + //关闭model + $('#bindOwnerShopsModel').modal('hide'); + vc.emit('shops', 'loadData', { + }); + return; + } + vc.toast(json); + }, + function (errInfo, error) { + console.log('请求失败处理'); + + vc.toast(errInfo); + }); + }, + _shopsLoadOwnerInfo: function () { + if ($that.bindOwnerShopsInfo.tel == '') { + return; + } + let param = { + params: { + page: 1, + row: 1, + communityId: vc.getCurrentCommunity().communityId, + ownerTypeCd: 1001, + link: $that.bindOwnerShopsInfo.tel + } + } + //发送get请求 + vc.http.get('listOwner', + 'list', + param, + function (json, res) { + let listOwnerData = JSON.parse(json); + let owners = listOwnerData.owners; + if (listOwnerData.total > 0) { + $that.bindOwnerShopsInfo.ownerId = owners[0].ownerId; + $that.bindOwnerShopsInfo.ownerName = owners[0].name; + }else{ + $that.bindOwnerShopsInfo.ownerId = ''; + $that.bindOwnerShopsInfo.ownerName = ''; + } + }, function (errInfo, error) { + console.log('请求失败处理'); + } + ); + }, + refreshAddShopsInfo: function () { + vc.component.bindOwnerShopsInfo = { + roomId: '', + roomNum: '', + shopsName: '', + ownerId: '', + ownerName: '', + tel: '', + startTime: '', + endTime: '', + remark: '', + communityId: '', + shopsState:'2006' + } + } + } + }); + +})(window.vc, window.vc.component); \ No newline at end of file diff --git a/public/pages/property/shops/shops.html b/public/pages/property/shops/shops.html index 411aef966..ff31cf05f 100644 --- a/public/pages/property/shops/shops.html +++ b/public/pages/property/shops/shops.html @@ -22,11 +22,9 @@
@@ -107,7 +105,7 @@
+ v-on:click="_openHireShopsModel(shops)">出租