init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
@@ -0,0 +1,369 @@
|
||||
<!--[1.6.48]-->
|
||||
<link rel="stylesheet" href="/Public/css/choose-store-goods.css">
|
||||
<script src="/Public/js/choose-store-goods.js?v=1.0.3"></script>
|
||||
<style>
|
||||
.content-search {
|
||||
padding: 0 0 20px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.content-search > .el-input,
|
||||
.content-search > .el-select,
|
||||
.content-search > .el-date-editor,
|
||||
.content-search > .el-button {
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.content-search > .el-button {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.content-search > .el-select .el-input {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.el-button--mini, .el-button--mini.is-round {
|
||||
padding: 5px 10px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.table-mini-img {
|
||||
max-width: 32px;
|
||||
max-height: 32px;
|
||||
}
|
||||
|
||||
.mini-avatar {
|
||||
max-width: 20px;
|
||||
max-height: 20px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.max-dialog-content {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
height: calc(100vh - 65px);
|
||||
overflow-y: auto;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<div id="newGoodsApp">
|
||||
<template v-if="page_disabled">
|
||||
<!--最新商品列表筛选选项-->
|
||||
<el-form :inline="true" size="small">
|
||||
<el-form-item>
|
||||
<el-button @click="chooseGoodsDialog=true"
|
||||
type="primary"
|
||||
v-if="operate.add"
|
||||
size="small">新增
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否开启最新商品">
|
||||
<el-switch :disabled="!operate.change"
|
||||
v-model="new_goods_status"
|
||||
:inactive-value="0"
|
||||
:active-value="1"
|
||||
:active-text="new_goods_status == 0 ? '关闭' : '开启' "
|
||||
@change="changeGoodsStatus">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!--最新商品列表-->
|
||||
<div style="width: 100%;">
|
||||
<el-table border :data="goodsList"
|
||||
style="width: 100%;"
|
||||
size="small">
|
||||
<el-table-column align="center" type="index" label="序号" width="50"></el-table-column>
|
||||
<el-table-column align="center" prop="goods_number" label="货号" min-width="100"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" prop="goods_name" label="商品名称" min-width="100"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" prop="goods_code" label="条码" min-width="100"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" prop="add_time" label="加入时间" min-width="100"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" prop="retail_price" label="零售价(元)" min-width="100"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" prop="online_price" label="商城价(元)" min-width="100"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" label="操作" v-if="operate.del">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="mini" @click="del(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<div slot="empty" v-if="!loading">暂无数据</div>
|
||||
<div slot="empty" v-else><span class="el-icon-loading"></span></div>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="searchForm.page"
|
||||
:page-sizes="[1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="currentLen">
|
||||
</el-pagination>
|
||||
</div>
|
||||
<!-- 新增最新商品 -->
|
||||
<el-dialog title="添加最新商品"
|
||||
:visible.sync="chooseGoodsDialog"
|
||||
:modal-append-to-body="true"
|
||||
:append-to-body="true"
|
||||
:top="'65px'"
|
||||
:width="'calc(100vw - 160px)'"
|
||||
:custom-class="'max-dialog-content'"
|
||||
:close-on-press-escape="false"
|
||||
:close-on-click-modal="false">
|
||||
<template-choose-store-goods :max_choose_num="100"
|
||||
:show="chooseGoodsDialog"
|
||||
:online_state="'1'"
|
||||
:status="'0'"
|
||||
:store_id="store_id"
|
||||
v-loading="submitLoading"
|
||||
@select-goods="selectGoods"></template-choose-store-goods>
|
||||
</el-dialog>
|
||||
</template>
|
||||
</div>
|
||||
<script>
|
||||
var newGoodsApp = new Vue({
|
||||
el: '#newGoodsApp',
|
||||
data: {
|
||||
store_id: '',
|
||||
new_goods_status: {$status},//最新商品开启状态
|
||||
searchForm: {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
},//搜索信息
|
||||
operate: {
|
||||
add: "{$authArr['addNewGoods']}",
|
||||
change: "{$authArr['changeNewStatus']}",
|
||||
del: "{$authArr['delNewGoods']}",
|
||||
},
|
||||
goodsList: [],//商品列表
|
||||
currentLen: 0,//商品列表总数量
|
||||
loading: false,//是否正在加载商品列表数据
|
||||
page_disabled: true,//页面是否可以操作
|
||||
chooseGoodsDialog: false,//是否显示新增商品
|
||||
submitLoading: false,//是否正在提交
|
||||
},
|
||||
methods: {
|
||||
//修改最新商品状态
|
||||
changeGoodsStatus() {
|
||||
$.ajax({
|
||||
url: "{:U('changeNewStatus')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
status: this.new_goods_status,
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.status == 1) {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
});
|
||||
} else {
|
||||
this.new_goods_status = this.new_goods_status == 1 ? 0 : 1;
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
});
|
||||
}
|
||||
},
|
||||
error: (data) => {
|
||||
console.log(data);
|
||||
this.$alert('请求发生错误,请稍后重试!', '错误提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
//删除最新商品
|
||||
del(id) {
|
||||
this.$confirm("确认删除该最新商品吗?", "温馨提示", {
|
||||
confirmButtonText: '删除',
|
||||
cancelButtonText: '取消',
|
||||
type: 'info'
|
||||
}).then(() => {
|
||||
$.ajax({
|
||||
url: "{:U('delNewGoods')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
id: id,
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.status == 1) {
|
||||
this.getData();
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
});
|
||||
} else {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
});
|
||||
}
|
||||
},
|
||||
error: (data) => {
|
||||
console.log(data);
|
||||
this.$alert('请求发生错误,请稍后重试!', '错误提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
//确认选择商品
|
||||
selectGoods(item) {
|
||||
this.$confirm("确认将已选商品添加为最新商品吗?", "温馨提示", {
|
||||
confirmButtonText: '添加',
|
||||
cancelButtonText: '取消',
|
||||
type: 'info'
|
||||
}).then(() => {
|
||||
this.submitLoading = true;
|
||||
let ids = [];
|
||||
for (let i in item) {
|
||||
ids.push(item[i].id);
|
||||
}
|
||||
$.ajax({
|
||||
url: "{:U('addNewGoods')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
id: ids,
|
||||
},
|
||||
success: (res) => {
|
||||
this.submitLoading = false;
|
||||
this.chooseGoodsDialog = false;
|
||||
if (res.status == 1) {
|
||||
this.getData();
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
});
|
||||
// if (res.error.length) {
|
||||
// let _html = '';
|
||||
// for (let j in res.error) {
|
||||
// _html += `<div>${res.error[j][1]}</div>`
|
||||
// }
|
||||
// this.$alert(`<div>${_html}</div>`, '失败列表', {
|
||||
// dangerouslyUseHTMLString: true,
|
||||
// callback: action => {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
} else {
|
||||
// if (res.error.length) {
|
||||
// let _html = '';
|
||||
// for (let j in res.error) {
|
||||
// _html += `<div>${res.error[j][1]}</div>`
|
||||
// }
|
||||
// this.$alert(`<div>${_html}</div>`, '失败列表', {
|
||||
// dangerouslyUseHTMLString: true,
|
||||
// callback: action => {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
this.$alert(res.msg, '操作失败', {
|
||||
confirmButtonText: '关闭',
|
||||
callback: action => {
|
||||
|
||||
}
|
||||
});
|
||||
// }
|
||||
}
|
||||
},
|
||||
error: (data) => {
|
||||
console.log(data);
|
||||
this.submitLoading = false;
|
||||
this.$alert('请求发生错误,请稍后重试!', '错误提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
//切换每页数量
|
||||
handleSizeChange(val) {
|
||||
this.searchForm.limit = val;
|
||||
this.searchForm.page = 1;
|
||||
this.getData();
|
||||
},
|
||||
//切换页数
|
||||
handleCurrentChange(val) {
|
||||
this.searchForm.page = val;
|
||||
this.getData();
|
||||
},
|
||||
//获取最新商品列表
|
||||
getData() {
|
||||
this.goodsList = [];
|
||||
this.loading = true;
|
||||
$.ajax({
|
||||
url: "{:U('newGoodsInfo')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
...this.searchForm,
|
||||
},
|
||||
success: (res) => {
|
||||
this.loading = false;
|
||||
if (res.code === 0) {
|
||||
this.goodsList = res.data;
|
||||
this.currentLen = res.count * 1;
|
||||
}
|
||||
},
|
||||
error: (data) => {
|
||||
console.log(data);
|
||||
this.loading = false;
|
||||
this.$alert('请求发生错误,请稍后重试!', '错误提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
//处理请求参数
|
||||
handleQueryVariable(callback) {
|
||||
var store_id = localStorage.store_id;
|
||||
if (store_id) {
|
||||
this.store_id = Number(store_id);
|
||||
callback();
|
||||
} else {
|
||||
this.page_disabled = false;
|
||||
this.$alert('您的操作有误,请正确的打开页面!', '错误提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.handleQueryVariable(() => {
|
||||
console.log(typeof this.store_id);
|
||||
this.getData();
|
||||
});
|
||||
}
|
||||
})
|
||||
</script>
|
||||
在新工单中引用
屏蔽一个用户