mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 05:46:03 +08:00
支持供应链功能
This commit is contained in:
parent
e84141fc2a
commit
a72c4df84b
174
public/pages/admin/addChainProduct/addChainProduct.html
Normal file
174
public/pages/admin/addChainProduct/addChainProduct.html
Normal file
@ -0,0 +1,174 @@
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox">
|
||||
<div class="ibox-title">
|
||||
<h5>商品信息</h5>
|
||||
<div class="ibox-tools" style="top:10px;">
|
||||
<button type="button" class="btn btn-white" v-on:click="_closeAddProduct()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-1 col-form-label text-right">商品名称</label>
|
||||
<div class="col-sm-5">
|
||||
<input v-model="addChainProductInfo.prodName" type="text" placeholder="必填,请填写商品名称" class="form-control">
|
||||
</div>
|
||||
<label class="col-sm-1 col-form-label text-right">商品分组</label>
|
||||
<div class="col-sm-5">
|
||||
<select class="custom-select" v-model="addChainProductInfo.catalogId">
|
||||
<option selected disabled value="">必填,请选择商品分组</option>
|
||||
<option v-for="(item,index) in addChainProductInfo.catalogs"
|
||||
:value="item.catalogId">{{item.catalogName}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-1 col-form-label text-right">单位</label>
|
||||
<div class="col-sm-5">
|
||||
<input v-model="addChainProductInfo.unitName" type="text" placeholder="选填,请填写单位" class="form-control">
|
||||
</div>
|
||||
<label class="col-sm-1 col-form-label text-right">排序</label>
|
||||
<div class="col-sm-5">
|
||||
<input v-model="addChainProductInfo.sort" type="text" placeholder="选填,请填写排序" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-1 col-form-label text-right">商品简介</label>
|
||||
<div class="col-sm-11">
|
||||
<textarea v-model="addChainProductInfo.prodDesc" placeholder="必填,请填写商品简介" maxlength="250" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox">
|
||||
<div class="ibox-title">
|
||||
<h5>商品图片</h5>
|
||||
<div class="ibox-tools" style="top:10px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-1 col-form-label text-right">商品封面</label>
|
||||
<div class="content-img col-sm-11">
|
||||
<vc:create path="frame/uploadImage" callBackListener="addProduct" callBackFunction="notifyUploadCoverImage" namespace="addProductCover" imageCount="1">
|
||||
</vc:create>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-1 col-form-label text-right">商品轮播</label>
|
||||
<div class="content-img col-sm-11">
|
||||
<vc:create path="frame/uploadImage" callBackListener="addProduct" callBackFunction="notifyUploadCarouselFigureImage" namespace="addProductCarouselFigure" imageCount="3">
|
||||
</vc:create>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox">
|
||||
<div class="ibox-title">
|
||||
<h5>商品规格</h5>
|
||||
<div class="ibox-tools" style="top:10px;">
|
||||
<button type="button" class="btn btn-primary btn-sm" v-on:click="_addChainProductSpec()">
|
||||
<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">规格名称</th>
|
||||
<th class="text-center">规格值</th>
|
||||
<th class="text-center">价格</th>
|
||||
<th class="text-center">条形码</th>
|
||||
<th class="text-center">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="productSpec in addChainProductInfo.productSpecs">
|
||||
<td class="text-center">
|
||||
<input class="form-control" v-model="productSpec.specName" type="text" /></td>
|
||||
<td class="text-center">
|
||||
<input class="form-control" v-model="productSpec.specValue" type="text" />
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input class="form-control" v-model="productSpec.price" type="number" />
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input class="form-control" v-model="productSpec.barCode" type="text">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group">
|
||||
<button class="btn-white btn btn-xs" v-on:click="_openAddDeleteProductSpec(productSpec)">删除
|
||||
</button>
|
||||
</div>
|
||||
<div class="btn-group" v-if="productSpec.isDefault != 'T'">
|
||||
<button class="btn-white btn btn-xs" v-on:click="_doAddDefaultProductSpec(addChainProductInfo,productSpec)">默认规格
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="10">
|
||||
<ul class="pagination float-right"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox">
|
||||
<div class="ibox-title">
|
||||
<h5>商品扩展</h5>
|
||||
<div class="ibox-tools" style="top:10px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-1 col-form-label text-right">商品状态</label>
|
||||
<div class="col-sm-11">
|
||||
<select class="custom-select" v-model="addChainProductInfo.state">
|
||||
<option selected disabled value="">选填,请选择状态</option>
|
||||
<option value="1001">未上架</option>
|
||||
<option value="2002">上架</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-1 col-form-label text-right">商品详情</label>
|
||||
<div class="col-sm-11 ">
|
||||
<div class=" no-padding">
|
||||
<div class="summernote"></div>
|
||||
</div>
|
||||
<!--<textarea v-model="addNoticeViewInfo.context" cols="3" type="text" placeholder="必填,请填写公告内容" class="form-control"></textarea>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<button class="btn btn-primary float-right" type="button" v-on:click="saveProductInfo()"><i
|
||||
class="fa fa-check"></i> 保存</button>
|
||||
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;" v-on:click="_closeAddProduct()">取消</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
294
public/pages/admin/addChainProduct/addChainProduct.js
Normal file
294
public/pages/admin/addChainProduct/addChainProduct.js
Normal file
@ -0,0 +1,294 @@
|
||||
(function(vc) {
|
||||
vc.extends({
|
||||
data: {
|
||||
addChainProductInfo: {
|
||||
productId: '',
|
||||
catalogId: '',
|
||||
prodName: '',
|
||||
prodDesc: '',
|
||||
unitName: '',
|
||||
sort: '',
|
||||
catalogs: [],
|
||||
content: '',
|
||||
states: [],
|
||||
state: '',
|
||||
coverPhoto: '',
|
||||
carouselFigurePhoto: [],
|
||||
productSpecs: [],
|
||||
areaCode: '',
|
||||
csId:''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"addChainProductInfo.productSpecs": {
|
||||
deep: true,
|
||||
handler: function() {}
|
||||
}
|
||||
},
|
||||
_initMethod: function() {
|
||||
vc.getDict('product', "state", function(_data) {
|
||||
vc.component.addChainProductInfo.states = _data;
|
||||
});
|
||||
$that.addChainProductInfo.csId = vc.getParam('csId');
|
||||
$that._listAddCatalogs();
|
||||
$that._initAddProduct();
|
||||
},
|
||||
_initEvent: function() {
|
||||
vc.on('addProduct', 'openAddProductModal', function() {
|
||||
$('#addProductModel').modal('show');
|
||||
});
|
||||
vc.on("addProduct", "notifyUploadCoverImage", function(_param) {
|
||||
if (_param.length > 0) {
|
||||
vc.component.addChainProductInfo.coverPhoto = _param[0];
|
||||
} else {
|
||||
vc.component.addChainProductInfo.coverPhoto = '';
|
||||
}
|
||||
});
|
||||
vc.on("addProduct", "notifyUploadCarouselFigureImage", function(_param) {
|
||||
vc.component.addChainProductInfo.carouselFigurePhoto = _param;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
addProductValidate() {
|
||||
return vc.validate.validate({
|
||||
addChainProductInfo: vc.component.addChainProductInfo
|
||||
}, {
|
||||
'addChainProductInfo.catalogId': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "商品大类不能为空"
|
||||
},
|
||||
{
|
||||
limit: "num",
|
||||
param: "",
|
||||
errInfo: "商品大类错误"
|
||||
},
|
||||
],
|
||||
'addChainProductInfo.prodName': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "商品名称不能为空"
|
||||
},
|
||||
{
|
||||
limit: "maxLength",
|
||||
param: "128",
|
||||
errInfo: "商品名称不能超过128位"
|
||||
},
|
||||
],
|
||||
'addChainProductInfo.prodDesc': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "商品简介不能为空"
|
||||
},
|
||||
{
|
||||
limit: "maxLength",
|
||||
param: "256",
|
||||
errInfo: "商品简介不能超过256位"
|
||||
},
|
||||
],
|
||||
'addChainProductInfo.unitName': [{
|
||||
limit: "maxLength",
|
||||
param: "32",
|
||||
errInfo: "单位不能超过32位"
|
||||
}, ],
|
||||
'addChainProductInfo.sort': [{
|
||||
limit: "num",
|
||||
param: "",
|
||||
errInfo: "排序格式错误"
|
||||
}, ],
|
||||
});
|
||||
},
|
||||
saveProductInfo: function() {
|
||||
let flag = false;
|
||||
let _productSpecs = $that.addChainProductInfo.productSpecs;
|
||||
for (let i = 0; i < _productSpecs.length; i++) {
|
||||
if (_productSpecs[i].isDefault == "T") {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag && _productSpecs.length > 0) {
|
||||
vc.toast("未选择默认规格");
|
||||
return;
|
||||
}
|
||||
if (!vc.component.addProductValidate()) {
|
||||
vc.toast(vc.validate.errInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
vc.http.apiPost(
|
||||
'/chainProduct.saveChainProduct',
|
||||
JSON.stringify(vc.component.addChainProductInfo), {
|
||||
emulateJSON: true
|
||||
},
|
||||
function(json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
let _json = JSON.parse(json);
|
||||
if (_json.code == 0) {
|
||||
//关闭model
|
||||
$('#addProductModel').modal('hide');
|
||||
vc.component.clearAddProductInfo();
|
||||
vc.emit('productManage', 'listProduct', {});
|
||||
vc.toast("添加成功");
|
||||
return;
|
||||
}
|
||||
vc.toast(_json.msg);
|
||||
},
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
vc.toast(errInfo);
|
||||
});
|
||||
},
|
||||
|
||||
clearAddProductInfo: function() {
|
||||
let _catalogs = $that.addChainProductInfo.catalogs;
|
||||
let _csId = $that.addChainProductInfo.csId;
|
||||
vc.component.addChainProductInfo = {
|
||||
productId: '',
|
||||
catalogId: '',
|
||||
prodName: '',
|
||||
prodDesc: '',
|
||||
unitName: '',
|
||||
sort: '',
|
||||
catalogs: _catalogs,
|
||||
content: '',
|
||||
states: [],
|
||||
state: '',
|
||||
coverPhoto: '',
|
||||
carouselFigurePhoto: [],
|
||||
productSpecs: [],
|
||||
areaCode: '',
|
||||
csId:_csId
|
||||
};
|
||||
},
|
||||
_closeAddProduct: function() {
|
||||
vc.goBack();
|
||||
},
|
||||
_listAddCatalogs: function(_page, _rows) {
|
||||
let param = {
|
||||
params: {
|
||||
page: 1,
|
||||
row: 50,
|
||||
csId: $that.addChainProductInfo.csId
|
||||
}
|
||||
};
|
||||
//发送get请求
|
||||
vc.http.apiGet('/chainSupplierCatalog.listChainSupplierCatalog',
|
||||
param,
|
||||
function(json, res) {
|
||||
let _productCategoryManageInfo = JSON.parse(json);
|
||||
$that.addChainProductInfo.catalogs = _productCategoryManageInfo.data;
|
||||
},
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
_initAddProduct: function() {
|
||||
let $summernote = $('.summernote').summernote({
|
||||
lang: 'zh-CN',
|
||||
height: 300,
|
||||
placeholder: '必填,请输入商品描述',
|
||||
callbacks: {
|
||||
onImageUpload: function(files, editor, $editable) {
|
||||
$that.sendFile($summernote, files);
|
||||
},
|
||||
onChange: function(contents, $editable) {
|
||||
$that.addChainProductInfo.content = contents;
|
||||
}
|
||||
},
|
||||
toolbar: [
|
||||
['style', ['style']],
|
||||
['font', ['bold', 'italic', 'underline', 'clear']],
|
||||
['fontname', ['fontname']],
|
||||
['color', ['color']],
|
||||
['para', ['ul', 'ol', 'paragraph']],
|
||||
['height', ['height']],
|
||||
['table', ['table']],
|
||||
['insert', ['link', 'picture']],
|
||||
['view', ['fullscreen', 'codeview']],
|
||||
['help', ['help']]
|
||||
],
|
||||
});
|
||||
},
|
||||
sendFile: function($summernote, files) {
|
||||
console.log('上传图片', files);
|
||||
var param = new FormData();
|
||||
param.append("uploadFile", files[0]);
|
||||
param.append('communityId', '123');
|
||||
vc.http.upload(
|
||||
'addNoticeView',
|
||||
'uploadImage',
|
||||
param, {
|
||||
emulateJSON: true,
|
||||
//添加请求头
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
},
|
||||
function(json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
if (res.status == 200) {
|
||||
var data = JSON.parse(json);
|
||||
//关闭model
|
||||
$summernote.summernote('insertImage', data.fileId);
|
||||
return;
|
||||
}
|
||||
vc.toast(json);
|
||||
},
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
vc.toast(errInfo);
|
||||
});
|
||||
},
|
||||
_openChooseSpecModal: function() {
|
||||
vc.emit('chooseProductSpec', 'openChooseProductSpecModel', {});
|
||||
},
|
||||
_openAddDeleteProductSpec: function(_productSpec) {
|
||||
let _productSpecs = $that.addChainProductInfo.productSpecs;
|
||||
let index = _productSpecs.indexOf(_productSpec);
|
||||
if (index > -1) {
|
||||
_productSpecs.splice(index, 1);
|
||||
}
|
||||
let flag = false;
|
||||
for (let i = 0; i < _productSpecs.length; i++) {
|
||||
if (_productSpecs[i].isDefault == "T") {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag && _productSpecs.length > 0) {
|
||||
_productSpecs[0].isDefault = "T"
|
||||
}
|
||||
},
|
||||
_doAddDefaultProductSpec: function(_product, _defaultProductSpec) {
|
||||
_product.productSpecs.forEach(item => {
|
||||
item.isDefault = "F";
|
||||
});
|
||||
_defaultProductSpec.isDefault = "T";
|
||||
$that.addChainProductInfo.productSpecs = JSON.parse(JSON.stringify(_product.productSpecs));
|
||||
},
|
||||
_addChainProductSpec:function(){
|
||||
let _productSpec = {
|
||||
specName:'',
|
||||
specValue:'',
|
||||
price:'',
|
||||
barCode:''
|
||||
};
|
||||
$that.addChainProductInfo.productSpecs.push(_productSpec);
|
||||
let _productSpecs = $that.addChainProductInfo.productSpecs;
|
||||
let flag = false;
|
||||
for (let i = 0; i < _productSpecs.length; i++) {
|
||||
if (_productSpecs[i].isDefault == "T") {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag && _productSpecs.length > 0) {
|
||||
_productSpecs[0].isDefault = "T"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
})(window.vc);
|
||||
128
public/pages/admin/chainProduct/chainProduct.html
Normal file
128
public/pages/admin/chainProduct/chainProduct.html
Normal file
@ -0,0 +1,128 @@
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox ">
|
||||
<div class="ibox-title">
|
||||
<h5>查询条件</h5>
|
||||
<div class="ibox-tools" style="top:10px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<select class="custom-select" v-model="chainProductInfo.conditions.categoryId">
|
||||
<option selected disabled value="">请选择商品分组</option>
|
||||
<option v-for="(item,index) in chainProductInfo.productCategorys"
|
||||
:value="item.categoryId">{{item.categoryName}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<input type="text" placeholder="请输入商品名称" v-model="chainProductInfo.conditions.prodName"
|
||||
class=" form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<select class="custom-select" v-model="chainProductInfo.conditions.state">
|
||||
<option selected disabled value="">请选择状态</option>
|
||||
<option v-for="(item,index) in chainProductInfo.states" :value="item.statusCd">
|
||||
{{item.name}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryProductMethod()">
|
||||
<i class="fa fa-search"></i> 查询
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-sm" v-on:click="_resetProductMethod()">
|
||||
<i class="fa fa-repeat"></i> 重置
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" >
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox">
|
||||
<div class="ibox-title">
|
||||
<h5>商品信息</h5>
|
||||
<div class="ibox-tools" style="top:10px;">
|
||||
<button type="button" class="btn btn-white btn-sm" v-on:click="_goBack()">
|
||||
返回
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddProductModal()">
|
||||
<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">商品ID</th>
|
||||
<th class="text-center">商品图片</th>
|
||||
<th class="text-center">商品分类</th>
|
||||
<th class="text-center">商品名称</th>
|
||||
<th class="text-center">库存</th>
|
||||
<th class="text-center">价格</th>
|
||||
<th class="text-center">排序</th>
|
||||
<th class="text-center">状态</th>
|
||||
<th class="text-center">创建时间</th>
|
||||
<th class="text-center">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="product in chainProductInfo.products">
|
||||
<td class="text-center">{{product.productId}}</td>
|
||||
<td class="text-center">
|
||||
<div style="position: relative; display: inline-block;">
|
||||
<img width="50" height="50" v-bind:src="product.coverPhoto"
|
||||
onerror="this.src='/img/noPhoto.jpg';">
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center">{{product.categoryName}}</td>
|
||||
<td class="text-center">{{product.prodName}}</td>
|
||||
<td class="text-center">{{product.shName}}</td>
|
||||
<td class="text-center">{{product.sales}}</td>
|
||||
<td class="text-center">{{product.stock}}</td>
|
||||
<td class="text-center">{{product.defaultSpecValue.price}}</td>
|
||||
<td class="text-center">{{product.sort}}</td>
|
||||
<td class="text-center">{{product.stateName}}</td>
|
||||
<td class="text-center">{{product.createTime}}</td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group">
|
||||
<button class="btn-white btn btn-xs"
|
||||
v-on:click="_openEditProductModel(product)">修改
|
||||
</button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button class="btn-white btn btn-xs"
|
||||
v-on:click="_openDeleteProductModel(product)">删除
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
<ul class="pagination float-right"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<!-- 分页 -->
|
||||
<vc:create path="frame/pagination"></vc:create>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<vc:create path="goods/deleteProduct"></vc:create>
|
||||
<vc:create path="goods/addProductLabel"></vc:create> -->
|
||||
</div>
|
||||
122
public/pages/admin/chainProduct/chainProduct.js
Normal file
122
public/pages/admin/chainProduct/chainProduct.js
Normal file
@ -0,0 +1,122 @@
|
||||
/**
|
||||
入驻小区
|
||||
**/
|
||||
(function (vc) {
|
||||
var DEFAULT_PAGE = 1;
|
||||
var DEFAULT_ROWS = 10;
|
||||
vc.extends({
|
||||
data: {
|
||||
chainProductInfo: {
|
||||
products: [],
|
||||
total: 0,
|
||||
records: 1,
|
||||
moreCondition: false,
|
||||
productId: '',
|
||||
conditions: {
|
||||
categoryId: '',
|
||||
state: '',
|
||||
prodName: '',
|
||||
keyword: '',
|
||||
barCode: '',
|
||||
csId:''
|
||||
},
|
||||
catalogs: [],
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
$that.chainProductInfo.conditions.csId = vc.getParam('csId');
|
||||
vc.component._listProducts(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
$that._listProductCategorys();
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('productManage', 'choose', function (_param) {
|
||||
$that._doEnterProductStock(_param.productId, _param.valueId);
|
||||
});
|
||||
vc.on('productManage', 'listProduct', function (_param) {
|
||||
$that.chainProductInfo.componentShow = 'productManage';
|
||||
vc.component._listProducts(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
});
|
||||
vc.on('pagination', 'page_event', function (_currentPage) {
|
||||
vc.component._listProducts(_currentPage, DEFAULT_ROWS);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
_listProducts: function (_page, _rows) {
|
||||
vc.component.chainProductInfo.conditions.page = _page;
|
||||
vc.component.chainProductInfo.conditions.row = _rows;
|
||||
var param = {
|
||||
params: vc.component.chainProductInfo.conditions
|
||||
};
|
||||
param.params.prodName = param.params.prodName.trim();
|
||||
//发送get请求
|
||||
vc.http.apiGet('/chainProduct.listChainProduct',
|
||||
param,
|
||||
function (json, res) {
|
||||
var _chainProductInfo = JSON.parse(json);
|
||||
vc.component.chainProductInfo.total = _chainProductInfo.total;
|
||||
vc.component.chainProductInfo.records = _chainProductInfo.records;
|
||||
vc.component.chainProductInfo.products = _chainProductInfo.data;
|
||||
vc.emit('pagination', 'init', {
|
||||
total: vc.component.chainProductInfo.records,
|
||||
dataCount: vc.component.chainProductInfo.total,
|
||||
currentPage: _page
|
||||
});
|
||||
}, function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
_listProductCategorys: function (_page, _rows) {
|
||||
let param = {
|
||||
params: {
|
||||
page: 1,
|
||||
row: 50,
|
||||
shopId: vc.getCurrentCommunity().shopId
|
||||
}
|
||||
};
|
||||
//发送get请求
|
||||
vc.http.apiGet('/chainSupplierCatalog.listChainSupplierCatalog',
|
||||
param,
|
||||
function (json, res) {
|
||||
let _productCategoryManageInfo = JSON.parse(json);
|
||||
$that.chainProductInfo.catalogs = _productCategoryManageInfo.data;
|
||||
}, function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
_openAddProductModal: function () {
|
||||
vc.jumpToPage('/#/pages/admin/addChainProduct?csId='+$that.chainProductInfo.conditions.csId);
|
||||
},
|
||||
_openEditProductModel: function (_product) {
|
||||
$that.chainProductInfo.componentShow = 'editProduct';
|
||||
vc.emit('editProduct', 'openEditProductModal', _product);
|
||||
},
|
||||
_openDeleteProductModel: function (_product) {
|
||||
vc.emit('deleteProduct', 'openDeleteProductModal', _product);
|
||||
},
|
||||
//查询
|
||||
_queryProductMethod: function () {
|
||||
vc.component._listProducts(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
},
|
||||
//重置
|
||||
_resetProductMethod: function () {
|
||||
vc.component.chainProductInfo.conditions.prodName = "";
|
||||
vc.component.chainProductInfo.conditions.categoryId = "";
|
||||
vc.component.chainProductInfo.conditions.state = "";
|
||||
vc.component._listProducts(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
},
|
||||
|
||||
_moreCondition: function () {
|
||||
if (vc.component.chainProductInfo.moreCondition) {
|
||||
vc.component.chainProductInfo.moreCondition = false;
|
||||
} else {
|
||||
vc.component.chainProductInfo.moreCondition = true;
|
||||
}
|
||||
},
|
||||
_goBack:function(){
|
||||
vc.goBack();
|
||||
}
|
||||
}
|
||||
});
|
||||
})(window.vc);
|
||||
@ -100,6 +100,9 @@
|
||||
<td class="text-center">{{chainSupplier.mchKey}}</td>
|
||||
<td class="text-center">{{chainSupplier.url}}</td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group">
|
||||
<button class="btn-white btn btn-xs" v-on:click="_toProductPage(chainSupplier)"><span><vc:i18n name="商品" namespace="propertyCompanyManage"></vc:i18n></span></button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button class="btn-white btn btn-xs" v-on:click="_openManageCatalog(chainSupplier)"><span><vc:i18n name="分类" namespace="propertyCompanyManage"></vc:i18n></span></button>
|
||||
</div>
|
||||
|
||||
@ -1,88 +1,91 @@
|
||||
/**
|
||||
入驻小区
|
||||
**/
|
||||
(function(vc){
|
||||
(function (vc) {
|
||||
var DEFAULT_PAGE = 1;
|
||||
var DEFAULT_ROWS = 10;
|
||||
vc.extends({
|
||||
data:{
|
||||
chainSupplierManageInfo:{
|
||||
chainSuppliers:[],
|
||||
total:0,
|
||||
records:1,
|
||||
moreCondition:false,
|
||||
csId:'',
|
||||
conditions:{
|
||||
name:'',
|
||||
url:'',
|
||||
mchId:'',
|
||||
data: {
|
||||
chainSupplierManageInfo: {
|
||||
chainSuppliers: [],
|
||||
total: 0,
|
||||
records: 1,
|
||||
moreCondition: false,
|
||||
csId: '',
|
||||
conditions: {
|
||||
name: '',
|
||||
url: '',
|
||||
mchId: '',
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
_initMethod:function(){
|
||||
_initMethod: function () {
|
||||
vc.component._listChainSuppliers(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
},
|
||||
_initEvent:function(){
|
||||
|
||||
vc.on('chainSupplierManage','listChainSupplier',function(_param){
|
||||
vc.component._listChainSuppliers(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
_initEvent: function () {
|
||||
|
||||
vc.on('chainSupplierManage', 'listChainSupplier', function (_param) {
|
||||
vc.component._listChainSuppliers(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
});
|
||||
vc.on('pagination','page_event',function(_currentPage){
|
||||
vc.component._listChainSuppliers(_currentPage,DEFAULT_ROWS);
|
||||
vc.on('pagination', 'page_event', function (_currentPage) {
|
||||
vc.component._listChainSuppliers(_currentPage, DEFAULT_ROWS);
|
||||
});
|
||||
},
|
||||
methods:{
|
||||
_listChainSuppliers:function(_page, _rows){
|
||||
methods: {
|
||||
_listChainSuppliers: function (_page, _rows) {
|
||||
|
||||
vc.component.chainSupplierManageInfo.conditions.page = _page;
|
||||
vc.component.chainSupplierManageInfo.conditions.row = _rows;
|
||||
var param = {
|
||||
params:vc.component.chainSupplierManageInfo.conditions
|
||||
};
|
||||
params: vc.component.chainSupplierManageInfo.conditions
|
||||
};
|
||||
|
||||
//发送get请求
|
||||
vc.http.apiGet('chainSupplier.listChainSupplier',
|
||||
param,
|
||||
function(json,res){
|
||||
var _chainSupplierManageInfo=JSON.parse(json);
|
||||
vc.component.chainSupplierManageInfo.total = _chainSupplierManageInfo.total;
|
||||
vc.component.chainSupplierManageInfo.records = _chainSupplierManageInfo.records;
|
||||
vc.component.chainSupplierManageInfo.chainSuppliers = _chainSupplierManageInfo.data;
|
||||
vc.emit('pagination','init',{
|
||||
total:vc.component.chainSupplierManageInfo.records,
|
||||
currentPage:_page
|
||||
});
|
||||
},function(errInfo,error){
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
//发送get请求
|
||||
vc.http.apiGet('chainSupplier.listChainSupplier',
|
||||
param,
|
||||
function (json, res) {
|
||||
var _chainSupplierManageInfo = JSON.parse(json);
|
||||
vc.component.chainSupplierManageInfo.total = _chainSupplierManageInfo.total;
|
||||
vc.component.chainSupplierManageInfo.records = _chainSupplierManageInfo.records;
|
||||
vc.component.chainSupplierManageInfo.chainSuppliers = _chainSupplierManageInfo.data;
|
||||
vc.emit('pagination', 'init', {
|
||||
total: vc.component.chainSupplierManageInfo.records,
|
||||
currentPage: _page
|
||||
});
|
||||
}, function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
_openAddChainSupplierModal:function(){
|
||||
vc.emit('addChainSupplier','openAddChainSupplierModal',{});
|
||||
_openAddChainSupplierModal: function () {
|
||||
vc.emit('addChainSupplier', 'openAddChainSupplierModal', {});
|
||||
},
|
||||
_openEditChainSupplierModel:function(_chainSupplier){
|
||||
vc.emit('editChainSupplier','openEditChainSupplierModal',_chainSupplier);
|
||||
_openEditChainSupplierModel: function (_chainSupplier) {
|
||||
vc.emit('editChainSupplier', 'openEditChainSupplierModal', _chainSupplier);
|
||||
},
|
||||
_openDeleteChainSupplierModel:function(_chainSupplier){
|
||||
vc.emit('deleteChainSupplier','openDeleteChainSupplierModal',_chainSupplier);
|
||||
_openDeleteChainSupplierModel: function (_chainSupplier) {
|
||||
vc.emit('deleteChainSupplier', 'openDeleteChainSupplierModal', _chainSupplier);
|
||||
},
|
||||
_queryChainSupplierMethod:function(){
|
||||
_queryChainSupplierMethod: function () {
|
||||
vc.component._listChainSuppliers(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
|
||||
},
|
||||
_openManageCatalog: function (_chainSupplier) {
|
||||
vc.jumpToPage('/#/pages/common/chainSupplierCatalogManage?csId=' + _chainSupplier.csId);
|
||||
},
|
||||
_moreCondition:function(){
|
||||
if(vc.component.chainSupplierManageInfo.moreCondition){
|
||||
_moreCondition: function () {
|
||||
if (vc.component.chainSupplierManageInfo.moreCondition) {
|
||||
vc.component.chainSupplierManageInfo.moreCondition = false;
|
||||
}else{
|
||||
} else {
|
||||
vc.component.chainSupplierManageInfo.moreCondition = true;
|
||||
}
|
||||
},
|
||||
_toProductPage:function(_supplier){
|
||||
vc.jumpToPage('/#/pages/admin/chainProduct?csId='+_supplier.csId)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
})(window.vc);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user