优化代码

This commit is contained in:
wuxw 2024-05-24 02:20:03 +08:00
parent ba2ed69094
commit 513213b9da
2 changed files with 97 additions and 195 deletions

View File

@ -1,146 +1,97 @@
<div>
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5>
<vc:i18n name="查询条件" namespace="merchantManage"></vc:i18n>
</h5>
<div class="ibox-tools" style="top:10px;"></div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-3">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请输入商家编号','merchantManage')"
v-model="merchantManageInfo.conditions.storeId" class=" form-control">
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请输入名称','merchantManage')"
v-model="merchantManageInfo.conditions.name" class=" form-control">
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请输入电话','merchantManage')"
v-model="merchantManageInfo.conditions.tel" class=" form-control">
</div>
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryMerchantMethod()">
<i class="fa fa-search"></i>查询
</button>
<button type="button" class="btn btn-primary btn-sm" v-on:click="_resetMerchantMethod()">
<i class="fa fa-repeat"></i>重置
</button>
</div>
<div class="ibox ">
<div class="ibox-title">
<h5>
<vc:i18n name="查询条件" namespace="merchantManage"></vc:i18n>
</h5>
<div class="ibox-tools" style="top:10px;"></div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-3">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请输入商家编号','merchantManage')"
v-model="merchantManageInfo.conditions.storeId" class=" form-control">
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请输入名称','merchantManage')"
v-model="merchantManageInfo.conditions.name" class=" form-control">
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请输入电话','merchantManage')"
v-model="merchantManageInfo.conditions.tel" class=" form-control">
</div>
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryMerchantMethod()">
<i class="fa fa-search"></i>查询
</button>
<button type="button" class="btn btn-primary btn-sm" v-on:click="_resetMerchantMethod()">
<i class="fa fa-repeat"></i>重置
</button>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>
<vc:i18n name="商家公司" namespace="merchantManage"></vc:i18n>
</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-white btn-sm"
v-on:click="vc.showMarkdown('/pages/admin/merchantManage')">
<vc:i18n name="文档"></vc:i18n>
</button>
<button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddMerchantModal()">
<i class="fa fa-plus"></i>添加
</button>
</div>
</div>
<div class="ibox-content">
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
<thead>
<tr>
<th class="text-center">
<vc:i18n name="编号" namespace="merchantManage"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="名称" namespace="merchantManage"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="地址" namespace="merchantManage"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="管理员" namespace="merchantManage"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="电话" namespace="merchantManage"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="创建时间" namespace="merchantManage"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="操作" namespace="merchantManage"></vc:i18n>
</th>
</tr>
</thead>
<tbody>
<tr v-for="propertyCompany in merchantManageInfo.propertyCompanys">
<td class="text-center">{{propertyCompany.storeId}}</td>
<td class="text-center">{{propertyCompany.name}}</td>
<td class="text-center">{{propertyCompany.address}}</td>
<td class="text-center">{{propertyCompany.tel}}</td>
<td class="text-center">{{propertyCompany.tel}}</td>
<td class="text-center">{{propertyCompany.createTime}}</td>
<td class="text-center">
<div class="btn-group">
<button class="btn-white btn btn-xs" v-if="propertyCompany.state != '48002'"
v-on:click="_openUpdateStoreStateModel(propertyCompany,'48002')">
<vc:i18n name="限制登录" namespace="merchantManage"></vc:i18n>
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs" v-else
v-on:click="_openUpdateStoreStateModel(propertyCompany,'48001')">
<vc:i18n name="恢复登录" namespace="merchantManage"></vc:i18n>
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_resetStaffPwd(propertyCompany)">
<vc:i18n name="重置密码" namespace="merchantManage"></vc:i18n>
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_toStoreShopPage(propertyCompany)">
<vc:i18n name="管理店铺" namespace="merchantManage"></vc:i18n>
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openDeleteMerchantModel(propertyCompany)">
<vc:i18n name="删除"></vc:i18n>
</button>
</div>
</td>
</tr>
</tbody>
</table>
<!-- 分页 -->
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-6">
<vc:create path="frame/pagination"></vc:create>
</div>
</div>
</div>
<div class="ibox">
<div class="ibox-title">
<h5>
<vc:i18n name="商家公司" namespace="merchantManage"></vc:i18n>
</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_toMerchantModal()">
管理
</button>
</div>
</div>
<div class="ibox-content">
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
<thead>
<tr>
<th class="text-center">
<vc:i18n name="编号" namespace="merchantManage"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="名称" namespace="merchantManage"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="地址" namespace="merchantManage"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="管理员" namespace="merchantManage"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="电话" namespace="merchantManage"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="创建时间" namespace="merchantManage"></vc:i18n>
</th>
</tr>
</thead>
<tbody>
<tr v-for="propertyCompany in merchantManageInfo.merchants">
<td class="text-center">{{propertyCompany.storeId}}</td>
<td class="text-center">{{propertyCompany.name}}</td>
<td class="text-center">{{propertyCompany.address}}</td>
<td class="text-center">{{propertyCompany.tel}}</td>
<td class="text-center">{{propertyCompany.tel}}</td>
<td class="text-center">{{propertyCompany.createTime}}</td>
</tr>
</tbody>
</table>
<!-- 分页 -->
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-6">
<vc:create path="frame/pagination"></vc:create>
</div>
</div>
</div>
</div>
<vc:create path="admin/addMerchantShop"></vc:create>
<vc:create path="admin/updateStoreState"></vc:create>
<vc:create path="frame/resetStaffPwd"></vc:create>
<vc:create path="admin/deleteMerchant"></vc:create>
</div>

View File

@ -7,7 +7,7 @@
vc.extends({
data: {
merchantManageInfo: {
propertyCompanys: [],
merchants: [],
total: 0,
records: 1,
moreCondition: false,
@ -16,7 +16,7 @@
storeId: '',
name: '',
tel: '',
storeTypeCd: '800900000005'
mallApiCode: 'queryMerchantBmoImpl'
}
}
},
@ -42,13 +42,13 @@
param.params.name = param.params.name.trim();
param.params.tel = param.params.tel.trim();
//发送get请求
vc.http.apiGet('/store.listStores',
vc.http.apiGet('/mall.getAdminMallOpenApi',
param,
function(json, res) {
var _merchantManageInfo = JSON.parse(json);
$that.merchantManageInfo.total = _merchantManageInfo.total;
$that.merchantManageInfo.records = _merchantManageInfo.records;
$that.merchantManageInfo.propertyCompanys = _merchantManageInfo.data;
let _json = JSON.parse(json);
$that.merchantManageInfo.total = _json.total;
$that.merchantManageInfo.records = _json.records;
$that.merchantManageInfo.merchants = _json.data;
vc.emit('pagination', 'init', {
total: $that.merchantManageInfo.records,
dataCount: $that.merchantManageInfo.total,
@ -60,32 +60,15 @@
}
);
},
_openAddMerchantModal: function() {
_toMerchantModal: function() {
vc.emit('addMerchantShop', 'openAddMerchantShopModal', {});
},
_openEditMerchantModel: function(_propertyCompany) {
vc.emit('editMerchant', 'openEditMerchantModal', _propertyCompany);
},
_openDeleteMerchantModel: function(_propertyCompany) {
vc.emit('deleteMerchant', 'openDeleteMerchantModal', {
storeId:_propertyCompany.storeId,
storeTypeCd:_propertyCompany.storeTypeCd
});
},
//查询
_queryMerchantMethod: function() {
$that._listMerchants(DEFAULT_PAGE, DEFAULT_ROWS);
},
//重置
_resetMerchantMethod: function() {
$that.merchantManageInfo.conditions.storeId = "";
$that.merchantManageInfo.conditions.name = "";
$that.merchantManageInfo.conditions.tel = "";
$that._listMerchants(DEFAULT_PAGE, DEFAULT_ROWS);
},
_toStoreShopPage: function(_store) {
vc.jumpToPage('/#/pages/admin/merchantShop?storeId=' + _store.storeId)
},
_moreCondition: function() {
if ($that.merchantManageInfo.moreCondition) {
$that.merchantManageInfo.moreCondition = false;
@ -93,38 +76,6 @@
$that.merchantManageInfo.moreCondition = true;
}
},
_openUpdateStoreStateModel: function(_listProperty, state) {
vc.emit('updateStoreState', 'open', {
storeId: _listProperty.storeId,
state: state,
stateName: state == '48002' ? '限制登录' : '恢复登录'
})
},
_resetStaffPwd: function(_listProperty) {
let param = {
params: {
page: 1,
row: 1,
relCd: '600311000001',
storeId: _listProperty.storeId
}
};
//发送get请求
vc.http.apiGet('/storeStaff/getPropertyStaffs',
param,
function(json, res) {
var _listPropertyManageInfo = JSON.parse(json);
vc.emit('resetStaffPwd', 'openResetStaffPwd', {
username: _listPropertyManageInfo.data[0].staffName,
userId: _listPropertyManageInfo.data[0].staffId,
curUserName: vc.getData('/nav/getUserInfo').name
});
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
}
}
});
})(window.vc);