文件

150 行
6.3 KiB
HTML
可执行文件

<!--[1.7.90]-->
<style>
.el-pagination {
padding: 8px;
}
.el-table__row>td:last-child>.cell {
white-space: nowrap;
}
#xcxGoodsApp .el-table thead th {
background: #f5f7fa;
}
#xcxGoodsApp .el-table--small td {
padding: 3px 0;
}
</style>
<div class="goodsBox" id="xcxGoodsApp" v-cloak>
<!--搜索及操作内容-->
<el-form label-width="90px" size="small">
<el-form-item label="关键词搜索">
<el-input :placeholder="'请输入'+(searchForm.keyword_type==1?'货号':(searchForm.keyword_type==2?'条码':'名称'))"
v-model="searchForm.keyword" oninput="value=this.value.trim(' ')" type="text" clearable
style="width: 300px" @keydown.enter.exact.native.prevent="searchGoods" class="input-with-select">
<el-select v-model="searchForm.keyword_type" style="width: 80px" background slot="prepend">
<el-option label="货号" :value="1"></el-option>
<el-option label="条码" :value="2"></el-option>
<el-option label="名称" :value="3"></el-option>
</el-select>
</el-input>
<!--设置默认的搜索关键词类型-->
<default-search-goods-type @change-type="changeKeywordType"></default-search-goods-type>
</el-form-item>
<el-form-item label="商品分类">
<select-goods-category :user-type="2" :store-id="store_id" :category-id1.sync="searchForm.person1"
:category-id2.sync="searchForm.person2" :category-id3.sync="searchForm.person3"></select-goods-category>
</el-form-item>
<!--搜索-->
<div style="display: flex;justify-content: space-between">
<el-form-item label="">
<el-button type="primary" @click="searchGoods">搜索</el-button>
</el-button>
</el-form-item>
</div>
</el-form>
<div style="border: 1px solid #e6e6e6;max-width: calc(100vw - 208px);margin-top: 10px;">
<el-table border :data="goodsList" style="width: 100%; border: none;" size="mini" max-height="500"
v-loading="loading" element-loading-text="数据获取中" element-loading-spinner="el-icon-loading">
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column prop="goods_number" label="货号" min-width="60"></el-table-column>
<el-table-column prop="goods_name" label="品名" min-width="100"></el-table-column>
<el-table-column prop="goods_code" label="商品条码" min-width="100"></el-table-column>
<el-table-column prop="purchase_price" label="成本价(元)" width="90"></el-table-column>
<el-table-column prop="retail_price" label="零售价(元)" width="90"></el-table-column>
<el-table-column prop="online_price" label="商城价(元)" width="90"></el-table-column>
<el-table-column prop="plus_price" label="Plus会员价(元)" width="120"></el-table-column>
<el-table-column prop="status_name" label="状态" width="70"></el-table-column>
<el-table-column prop="cate_name" label="类别名称" width="100"></el-table-column>
<el-table-column prop="goods_num" label="库存" width="80"></el-table-column>
<el-table-column label="线上打折" width="80">
<template slot-scope="scope">
<el-switch disabled v-model="scope.row.vip_online_state" inactive-value="0" active-value="1">
</el-switch>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
:page-sizes="[10, 15, 20, 25, 30, 35, 40, 45, 50]" :page-size="100"
layout="total, sizes, prev, pager, next, jumper" :total="currentLen">
</el-pagination>
</div>
</div>
<script src="/Public/Retail/common/js/select-goods-category.js"></script>
<script src="/Public/Retail/js/default-search-goods-type.js"></script>
<script type="text/javascript">
new Vue({
el: '#xcxGoodsApp',
data() {
return {
searchForm: {
online_state: 1,
keyword_type: 2,
keyword: '',
person1: '',
person2: '',
person3: '',
},
store_id: localStorage.store_id,
goodsList: [],
currentLen: 0,
currentPage: 1,
currentLimit: 10,
}
},
methods: {
//修改默认关键词类型
changeKeywordType(val) {
this.searchForm.keyword_type = val;
},
handleSizeChange(val) {
this.currentLimit = val;//切换每页数量
this.currentPage = 1;
this.getData();
},
handleCurrentChange(val) {
this.currentPage = val;
this.getData();//切换页数
},
searchGoods() {
this.currentPage = 1;
this.getData();
},
getData() {
this.loading = true;
$.ajax({
url: "{:U(goodsList)}",
type: 'POST',
data: {
page: this.currentPage,
limit: this.currentLimit,
...this.searchForm,
},
success: (res) => {
this.loading = false;
if (res.code == 0) {
this.goodsList = [];
this.goodsList = res.data;
this.$nextTick(() => {
this.currentLen = parseInt(res.count);
})
} else {
this.$message.error(res.msg)
}
},
error: () => {
this.loading = false;
}
});
}
},
created() {
this.getData();
},
})
</script>