文件
mashangyoujiu/Application/Retail/View/Goods/two_sync_goods.html

386 行
19 KiB
HTML
可执行文件

<!doctype html>
<html>
<!--[1.8.32]-->
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>同步商品</title>
<link rel="stylesheet" href="__PUBLIC__/vue/element-ui.css">
<style>
[v-cloak] {
display: none;
}
.seek {
margin-right: 10px;
margin-top: 10px;
white-space: nowrap;
}
.dialog {
width: 60%;
}
.update_field {
margin-bottom: 10px;
}
.el-form-item {
margin-bottom: 22px;
}
</style>
</head>
<body>
<div id="app" v-cloak style="width: 100%;padding-left: 10px;">
<div style="margin:20px;">
<el-collapse accordion>
<el-collapse-item>
<template slot="title">
更新商品须知>>></i>
</template>
<div>1.若该门店已同步了商户的A商品,商户修改了A商品,则A商品会出现在门店的更新商品列表里,门店可选择A商品今天更新操作</div>
</el-collapse-item>
</el-collapse>
</div>
<!-- 搜索数据 -->
<div style="display: flex;padding-bottom: 10px;flex-wrap: wrap;margin-left: 10px;">
<div class="seek">
<el-input v-model="seek_data.goods_name" placeholder="商品名称" clearable size="small"
style="width: 220px;"></el-input>
</div>
<div class="seek">
<el-input v-model="seek_data.keyword" placeholder="货号/条码" clearable size="small"
style="width: 220px;"></el-input>
</div>
<div class="seek">
<select-goods-category :user-type="2"
:store-id="store_id"
:category-id1.sync="seek_data.person1"
:category-id2.sync="seek_data.person2"
:category-id3.sync="seek_data.person3"></select-goods-category>
</div>
<div class="seek" style="display: flex;text-align: center;">
<el-button type="primary" @click="pageChange(1)" size="small">查询</el-button>
<el-button @click="reset" size="small">重置</el-button>
</div>
</div>
<div style="margin-left: 10px;color: #606266;font-size: 14px;padding: 5px 0px;">
<span>选择更新字段:</span>
</div>
<!-- 复选框 -->
<el-checkbox-group v-model="check_list" size="mini">
<el-checkbox class="update_field" border label="name" style="margin-left: 10px;">名称</el-checkbox>
<el-checkbox class="update_field" border label="class">分类</el-checkbox>
<el-checkbox class="update_field" border label="image">图片</el-checkbox>
<el-checkbox class="update_field" border label="number">货号</el-checkbox>
<el-checkbox class="update_field" border label="code">条码</el-checkbox>
<el-checkbox class="update_field" border label="company">单位</el-checkbox>
<el-checkbox class="update_field" border label="weight_value">重量</el-checkbox>
<el-checkbox class="update_field" border label="specifications">规格(描述)</el-checkbox>
<el-checkbox class="update_field" border label="supplier">供货商</el-checkbox>
<el-checkbox class="update_field" border label="brand">品牌</el-checkbox>
<el-checkbox class="update_field" border label="subheading">副标题</el-checkbox>
<el-checkbox class="update_field" border label="yieldly">产地</el-checkbox>
<el-checkbox class="update_field" border label="details">详情</el-checkbox>
<el-checkbox class="update_field" border label="retail_price">零售价</el-checkbox>
<el-checkbox class="update_field" border label="online_price">商城价</el-checkbox>
<el-checkbox class="update_field" border label="retail_state">门店折扣</el-checkbox>
<el-checkbox class="update_field" border label="online_state">商城折扣</el-checkbox>
<el-checkbox class="update_field" border label="store_vip_price">门店会员价</el-checkbox>
<el-checkbox class="update_field" border label="shop_vip_price">商城会员价</el-checkbox>
<el-checkbox class="update_field" border label="plus_price">Plus价</el-checkbox>
<el-checkbox class="update_field" border label="issellonline">出售类型</el-checkbox>
<el-checkbox class="update_field" border label="weigh">称重类型</el-checkbox>
<el-checkbox class="update_field" border label="status">商品状态</el-checkbox>
<el-checkbox class="update_field" border label="swiper">轮播图</el-checkbox>
<el-checkbox class="update_field" border label="sku">多规格(详情)</el-checkbox>
<el-checkbox class="update_field" border label="goods_label">商品标签</el-checkbox>
</el-checkbox-group>
<!-- 列表展示 -->
<div style="margin-left: 10px;">
<div style="padding-bottom: 10px;">
<el-button type="primary" size="small" @click="batchUpdate">批量更新</el-button>
</div>
<el-table :data="update_goods" border size="mini" @selection-change="ChooseSelectionChange"
style="width:calc(100% - 20px)">
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column type="index" label="序号" width="60" align="center"></el-table-column>
<el-table-column label="商品图片" width="100">
<template slot-scope="scope">
<img v-if="scope.row.goods_image" :src="scope.row.goods_image"
style="max-height: 80px;max-width: 80px;">
<span v-else>暂无图片</span>
</template>
</el-table-column>
<el-table-column prop="goods_name" label="商品名称" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="subheading" label="副标题" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="class_name" label="商品分类" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="good_number" label="商品货号" width="120"
:show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="code_name" label="商品条码" width="120" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="goods_brand" label="品牌" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="goods_yieldly" label="产地" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="company" label="单位" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="weight_value" label="重量/kg" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="specifications" label="规格(描述)" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="售价" align="center">
<el-table-column prop="retail_price" label="店内" width="80"
:show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="online_price" label="商城" width="80"
:show-overflow-tooltip="true"></el-table-column>
</el-table-column>
<el-table-column label="会员价" align="center">
<el-table-column prop="store_vip_price" label="店内" width="80"
:show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="shop_vip_price" label="商城" width="80"
:show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="plus_price" label="Plus价" width="80"
:show-overflow-tooltip="true"></el-table-column>
</el-table-column>
<el-table-column label="类型" width="100">
<template slot-scope="scope">
<span v-if="scope.row.attribute == 1">普通商品</span>
<el-button v-else type="text" size="small"
@click="getMgoodsSku(scope.row.id,scope.row.shop_mem_status,scope.row.store_mem_status)">
规格信息
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChange"
@current-change="pageChange"
layout="total, sizes, prev, pager, next, jumper"
:pager-count="5"
:page-sizes="[10,20,30,40,50,60,70,80,90]"
:page-size="10"
:total="total">
</el-pagination>
</div>
<!-- 规格信息 -->
<el-dialog :modal-append-to-body="false" :visible.sync="show_sku" custom-class="dialog">
<template>
<el-table border :data="sku" size="small" max-height="500">
<el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
<el-table-column label="规格图片" width="100">
<template slot-scope="scope">
<img v-if="scope.row.goods_image" :src="scope.row.goods_image"
style="max-height: 80px;max-width: 80px;">
<span v-else>暂无图片</span>
</template>
</el-table-column>
<el-table-column prop="sku_name" label="规格名称" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="weight_value" label="重量/kg" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="sku_goods_number" label="规格货号" width="120"></el-table-column>
<el-table-column prop="sku_code" label="规格条码" width="120"></el-table-column>
<el-table-column prop="sku_num" label="库存基数" width="100"></el-table-column>
<el-table-column label="售价" align="center">
<el-table-column prop="retail_price" label="店内" width="100"></el-table-column>
<el-table-column prop="online_price" label="商城" width="100"></el-table-column>
</el-table-column>
<el-table-column label="会员价" align="center">
<el-table-column prop="store_vip_price" label="店内" width="100"></el-table-column>
<el-table-column prop="shop_vip_price" label="商城" width="100"></el-table-column>
<el-table-column prop="plus_price" label="Plus价" width="100"></el-table-column>
</el-table-column>
</el-table>
</template>
</el-dialog>
<!-- 更新失败原因 -->
<el-dialog :modal-append-to-body="false" :visible.sync="show_error">
<template>
<el-table border :data="error_journal" size="small" max-height="500">
<el-table-column type="index" width="80" align="center"></el-table-column>
<el-table-column prop="goods_name" label="商品名称" width="220"
:show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="error" label="失败原因"></el-table-column>
</el-table>
</template>
</el-dialog>
</div>
</body>
<script src="__PUBLIC__/jquery/js/jquery-3.2.1.min.js"></script>
<script src="__PUBLIC__/vue/js/vue2.5.16.js"></script>
<script src="__PUBLIC__/vue/element-ui.js"></script>
<script src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Retail/common/js/select-goods-category.js"></script>
<script>
var app = new Vue({
el: '#app',
data: function () {
return {
store_id: localStorage.store_id,
seek_data: { // 搜索数据
goods_name: '', // 商品名称
keyword: '', // 商品货号、条码
person1:'', // 商品分类
person2:'', // 商品分类
person3:'', // 商品分类
},
check_list: [ // 勾选了的更新类型
'name', 'class', 'image', 'number', 'code', 'company', 'subheading', 'specifications', 'supplier', 'brand', 'yieldly', 'details', 'retail_price', 'online_price', 'retail_state', 'online_state', 'store_vip_price', 'shop_vip_price', 'issellonline', 'weigh', 'status'
],
update_goods: [], // 更新商品列表
chose_goods: [], // 勾选了的商品
page: 1, // 分页
limit: 10, // 每页显示条数
total: 0, // 总数 [int]
show_sku: false, // 规格信息(显示,隐藏)
sku: [], // 规格
show_error: false, // 显示错误日志
error_journal: [], // 错误日志
props: { // 定义层级选择器
'value': 'id',
'label': 'class_name',
},
};
},
methods: {
// 获取更新商品
getUpdateGoods() {
var that = this;
that.$loading({
lock: true,
text: '数据获取中,请等待...',
spinner: 'el-icon-loading',
background: 'rgba(255, 255, 255, 0.7)'
});
$.ajax({
url: "{:U('getUpdateGoods')}",
type: "post",
data: {seek_data: that.seek_data, page: that.page, limit: that.limit},
success: function (res) {
that.$loading().close();
if (res.status == 1) {
that.update_goods = res.update_goods;
that.total = res.total;
} else {
that.update_goods = [];
that.total = 0;
}
}
})
},
// 重置表单
reset() {
var seek_data = {
goods_name: '',
keyword: '',
person1:'',
person2:'',
person3:'',
};
this.seek_data = seek_data;
this.pageChange(1);
},
// 分页
pageChange(val) {
this.page = val;
this.getUpdateGoods();
},
// 显示数量
sizeChange(val) {
this.limit = val;
this.page = 1;
this.getUpdateGoods();
},
// 规格信息
getMgoodsSku(mgoods_id, shop_mem_status, store_mem_status) {
var that = this;
$.ajax({
url: "{:U('getMgoodsSku')}",
type: "post",
data: {mgoods_id: mgoods_id, shop_mem_status: shop_mem_status, store_mem_status: store_mem_status},
success: function (res) {
if (res.status == 1) {
that.sku = res.sku;
that.show_sku = true;
} else {
that.$message({
message: res.msg,
type: 'warning'
})
return false;
}
}
})
},
// 选择商品
ChooseSelectionChange(data) {
this.chose_goods = data;
},
// 批量更新
batchUpdate() {
var that = this;
if (that.check_list.length <= 0) {
that.$message({
message: '提示:请选择更新字段',
type: 'warning'
})
return false;
}
if (this.chose_goods.length <= 0) {
that.$message({
message: '提示:请选择更新商品',
type: 'warning'
})
return false;
}
that.$loading({
lock: true,
text: '更新中...',
spinner: 'el-icon-loading',
background: 'rgba(255, 255, 255, 0.7)'
});
$.ajax({
url: "{:U('batchUpdate')}",
type: "post",
data: {check_list: that.check_list, chose_goods: JSON.stringify(that.chose_goods)},
success: function (res) {
that.$loading().close();
that.pageChange(1);
if (res.status == 1) {
that.$message({
message: res.msg,
type: 'success'
})
} else if (res.status == 2) {
that.$confirm('部分商品更新失败,点击确定打开失败原因列表', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.show_error = true;
that.error_journal = res.error_journal;
}).catch(() => {
that.error_journal = res.error_journal;
})
} else {
that.$message({
message: res.msg,
type: 'error'
})
return false;
}
}
})
},
},
created: function () {
this.pageChange(1);
},
})
</script>
</html>