first commit
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
let ADDRESS_DIALOG = {
|
||||
template: `
|
||||
<el-dialog
|
||||
:append-to-body="true"
|
||||
:modal-append-to-body="false"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="dialogVisible"
|
||||
title="收货地址"
|
||||
width="30%">
|
||||
|
||||
<el-form :model="formData" label-position="right"
|
||||
label-suffix=":" label-width="120px" ref="addForm">
|
||||
<el-row :gutter="60">
|
||||
<el-col :span="24">
|
||||
<el-form-item :rules="{required:true,message: '请选择地址信息', trigger: 'blur'}"
|
||||
label="地址信息"
|
||||
prop="addressList">
|
||||
<el-cascader
|
||||
:options="dzOptions"
|
||||
:props="{ expandTrigger: 'hover' }"
|
||||
@change="handleChange"
|
||||
clearable
|
||||
placeholder="请选择地址信息"
|
||||
style="width: 100%"
|
||||
v-model="formData.addressList"></el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item
|
||||
:rules="{required:true,message: '请填写您的详细地址', trigger: 'blur'}"
|
||||
label="详细地址"
|
||||
prop="addressDetail">
|
||||
<el-input maxlength="100"
|
||||
placeholder="请输入详细地址信息,如道路、门牌号、小区、楼栋号、单元等信息"
|
||||
rows="3"
|
||||
show-word-limit
|
||||
type="textarea"
|
||||
v-model="formData.addressDetail"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item
|
||||
:rules="{required:true,message: '请填写收货人姓名', trigger: 'blur'}"
|
||||
label="收货人姓名"
|
||||
prop="userName">
|
||||
<el-input maxlength="11"
|
||||
placeholder="请填写收货人姓名"
|
||||
v-model="formData.userName"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item
|
||||
:rules="{required:true,message: '请填写手机号码', trigger: 'blur'}"
|
||||
label="手机号码"
|
||||
prop="tel">
|
||||
<el-input maxlength="11" placeholder="请填写手机号码"
|
||||
type="tel"
|
||||
v-model="formData.tel"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<span class="dialog-footer" slot="footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button @click="doSaveUserAddress" type="primary">保存</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
`,
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
dzOptions: chengShiList,
|
||||
dialogVisible: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleChange(val) {
|
||||
if (val) {
|
||||
let provinceName = ""
|
||||
let cityName = ""
|
||||
let countyName = ""
|
||||
const province = this.dzOptions.find(c => c.value === val[0])
|
||||
provinceName = province.label
|
||||
const city = province.children.find(p => p.value === val[1])
|
||||
cityName = city.label
|
||||
if (val.length === 3) {
|
||||
const county = city.children.find(p => p.value === val[2])
|
||||
countyName = county.label
|
||||
this.$set(this.formData, "areaCode", county.value)
|
||||
} else {
|
||||
this.$set(this.formData, "areaCode", city.value)
|
||||
}
|
||||
this.$set(this.formData, "province", provinceName)
|
||||
this.$set(this.formData, "city", cityName)
|
||||
this.$set(this.formData, "county", countyName)
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
doSaveUserAddress() {
|
||||
this.$refs["addForm"].validate(async (valid) => {
|
||||
if (valid) {
|
||||
const resp = await this.$axios.post("/platform/benefit/address/doSaveUserAddress", {data: JSON.stringify(this.formData)})
|
||||
if (resp.code === 0) {
|
||||
this.$message({
|
||||
message: resp.msg,
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit("select_user_address")
|
||||
this.dialogVisible = false
|
||||
} else {
|
||||
this.$message.error(resp.msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
openEdit(row) {
|
||||
row.addressList = []
|
||||
const province = chengShiList.find(c => c.label === row.province)
|
||||
row.addressList.push(province.value)
|
||||
const city = province.children.find(p => p.label === row.city)
|
||||
row.addressList.push(city.value)
|
||||
if (row.county){
|
||||
const county = city.children.find(p => p.label === row.county)
|
||||
if (county) {
|
||||
row.addressList.push(county.value)
|
||||
}
|
||||
}
|
||||
|
||||
this.formData = row
|
||||
this.dialogVisible = true
|
||||
},
|
||||
}
|
||||
}
|
||||
<!--#include("/platform/zhgh/welfare/include/chengSh.js"){}#-->
|
||||
@@ -0,0 +1,145 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<div id="app">
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<table-tool :app="this" label="收货地址">
|
||||
<el-button @click="openAddress" size="small" type="primary">新增地址</el-button>
|
||||
</table-tool>
|
||||
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:size="tableSize"
|
||||
@sort-change="pageOrder"
|
||||
ref="table"
|
||||
row-key="id"
|
||||
style="width: 100%"
|
||||
v-loading="tableLoading"
|
||||
>
|
||||
<el-table-column label="序号" type="index" width="80px"></el-table-column>
|
||||
<el-table-column
|
||||
:key="column.prop"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template scope="{row}" v-if="column.prop=='address'">{{row.province}} {{row.city}} {{row.county}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" header-align="center" label="是否默认地址" width="110px">
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="mini" v-if="scope.row.isDefault" type="success" effect="plain">是</el-tag>
|
||||
<el-tag size="mini" v-else type="info" effect="plain">否</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" header-align="center" label="操作" prop="userOnline" width="170px">
|
||||
<template scope="{row}">
|
||||
<el-button @click="openEdit(row)" size="mini" type="primary">修改</el-button>
|
||||
<el-button @click="doDelete(row.id)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" header-align="center" label="" prop="userOnline" width="170px">
|
||||
<template scope="{row}">
|
||||
<span v-if="row.isDefault">
|
||||
<el-tag type="danger">默认地址</el-tag>
|
||||
</span>
|
||||
<span v-else>
|
||||
<el-button @click="doDefault(row)" size="mini" type="primary">设为默认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
</guava>
|
||||
<address-dialog ref="addressDialog" @select_user_address="selectUserAddress"></address-dialog>
|
||||
</div>
|
||||
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include("addressDialog.js"){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
dzOptions: chengShiList,
|
||||
dialogVisible: false,
|
||||
tableColumns: [
|
||||
{ prop: "userName", label: "收货人" },
|
||||
{ prop: "address", label: "所在地区" },
|
||||
{ prop: "addressDetail", label: "详细地址" },
|
||||
{ prop: "tel", label: "电话" }
|
||||
]
|
||||
}
|
||||
},
|
||||
components: {
|
||||
"address-dialog": ADDRESS_DIALOG
|
||||
},
|
||||
methods: {
|
||||
selectUserAddress() {
|
||||
this.pageData()
|
||||
},
|
||||
pageData() {
|
||||
this.tableLoading = true
|
||||
this.$axios.post("/platform/benefit/address/selectUserAddress", this.pageForm).then((resp) => {
|
||||
this.tableLoading = false
|
||||
if (resp.code === 0) {
|
||||
this.tableData = resp.data
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
openAddress() {
|
||||
this.$refs.addressDialog.dialogVisible = true
|
||||
this.$refs.addressDialog.formData = {}
|
||||
},
|
||||
doDelete(id) {
|
||||
this.$confirm("此操作将永久删除该地址, 是否继续?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(async () => {
|
||||
const resp = await this.$axios.post("/platform/benefit/address/deleteAddress", { id: id })
|
||||
if (resp.code === 0) {
|
||||
this.doSearch()
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: resp.msg
|
||||
})
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
openEdit(row) {
|
||||
this.$refs.addressDialog.dialogVisible = true
|
||||
this.$refs.addressDialog.openEdit(row)
|
||||
},
|
||||
async doDefault(row) {
|
||||
const resp = await this.$axios.post(loc() + "/doDefault", { id: row.id })
|
||||
if (resp.code === 0) {
|
||||
this.doSearch()
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: resp.msg
|
||||
})
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,388 @@
|
||||
let BENEFIT_GOODS_FORM = {
|
||||
/*language=HTML*/
|
||||
template: `
|
||||
<div>
|
||||
<el-dialog :title="formData.id ? '编辑商品' : '新增商品'"
|
||||
:visible.sync="visibleDialog" :close-on-click-modal="false" width="60%">
|
||||
<el-form :model="formData" ref="formRef" :rules="formRules"
|
||||
label-width="0" class="benefitGoodsForm">
|
||||
<el-descriptions border class="descriptions-form" :column="2">
|
||||
<el-descriptions-item label="商品名称">
|
||||
<el-form-item prop="name" label="">
|
||||
<el-input maxlength="40" placeholder="商品名称" show-word-limit
|
||||
v-model="formData.name"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="所需积分">
|
||||
<el-form-item prop="money" label="">
|
||||
<el-input-number :max="9999" :precision="2" placeholder="所需积分"
|
||||
v-model="formData.money"
|
||||
:min="1"
|
||||
style="width: 100%"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="发放形式">
|
||||
<el-form-item prop="goodsProvideMode" label="">
|
||||
<dict-select clearable code="BENEFIT_GOODS_PROVIDE_MODE"
|
||||
placeholder="请选择发放形式"
|
||||
v-model="formData.goodsProvideMode"></dict-select>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="排序">
|
||||
<el-form-item prop="goodsSort" label="">
|
||||
<el-input-number :max="9999" placeholder="排序"
|
||||
v-model="formData.goodsSort"
|
||||
:min="1"
|
||||
style="width: 100%"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="所属一级分类">
|
||||
<el-form-item prop="goodsCategoryOneLevelId" label="">
|
||||
<el-select v-model="formData.goodsCategoryOneLevelId"
|
||||
placeholder="请选择所属一级分类" style="width: 100%"
|
||||
@change="goodsCategoryOneLevelChange">
|
||||
<el-option
|
||||
v-for="item in goodsCategoryOneLevelOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="所属二级分类">
|
||||
<el-form-item prop="goodsCategoryTwoLevelId" label="">
|
||||
<el-select v-model="formData.goodsCategoryTwoLevelId"
|
||||
placeholder="请选择所属二级分类" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in goodsCategoryTwoLevelOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="简短描述" span="2">
|
||||
<el-form-item prop="simpleDesc" label="">
|
||||
<el-input maxlength="80" placeholder="简短描述" show-word-limit
|
||||
v-model="formData.simpleDesc"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="商品规格"
|
||||
v-if="formData.goodsProvideMode==='GOODS_PROVIDE_MODE_POST'
|
||||
||formData.goodsProvideMode==='GOODS_PROVIDE_MODE_SHOPPING'">
|
||||
<el-button type="primary" size="mini"
|
||||
@click="goodsSpecificationsVisibleDialog = true">
|
||||
点击设置商品规格
|
||||
</el-button>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="门店地址"
|
||||
v-if="formData.goodsProvideMode==='GOODS_PROVIDE_MODE_SHOP'">
|
||||
<el-button type="primary" size="mini"
|
||||
@click="goodsShopAddressVisibleDialog = true">
|
||||
点击设置门店地址
|
||||
</el-button>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="邮寄发放配置"
|
||||
v-if="formData.goodsProvideMode==='GOODS_PROVIDE_MODE_POST'">
|
||||
<el-button type="primary" size="mini"
|
||||
@click="postProvideConfigVisibleDialog=true">点击设置邮寄发放配置
|
||||
</el-button>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-if="formData.goodsProvideMode==='GOODS_PROVIDE_MODE_SHOPPING'||
|
||||
formData.goodsProvideMode==='GOODS_PROVIDE_MODE_SHOP'"></el-descriptions-item>
|
||||
<el-descriptions-item label="说明描述" span="2">
|
||||
<el-form-item prop="description" label="">
|
||||
<text-editor v-model="formData.description"></text-editor>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="图片" span="2">
|
||||
<el-form-item prop="imgUrl" label="">
|
||||
<file-upload :upload_number="5" :value.sync="formData.imgUrl"
|
||||
accept=".jpg,.jpeg,.png"
|
||||
class="imgUrl"
|
||||
upload_result_type="url"
|
||||
complete_result upload_mode="drag"
|
||||
upload_result_category="array"></file-upload>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="主页展示" span="2">
|
||||
<el-form-item prop="isHomepage" label="">
|
||||
<el-radio-group v-model="formData.isHomepage">
|
||||
<el-radio-button label="true">是</el-radio-button>
|
||||
<el-radio-button label="false">否</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="formData.isHomepage" label="主页轮播图片" span="2">
|
||||
<el-form-item prop="carouselImgUrl" label="">
|
||||
<file-upload :upload_number="1" :value.sync="formData.carouselImgUrl"
|
||||
accept=".jpg,.jpeg,.png"
|
||||
class="imgUrl"
|
||||
upload_result_type="url"
|
||||
complete_result upload_mode="drag"
|
||||
upload_result_category="array"></file-upload>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visibleDialog = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">提 交</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="配置商品规格"
|
||||
:visible.sync="goodsSpecificationsVisibleDialog"
|
||||
:close-on-click-modal="false"
|
||||
width="50%">
|
||||
<el-table :data="formData.benefitGoodsSpecificationsList">
|
||||
<el-table-column
|
||||
label="序号"
|
||||
type="index"
|
||||
width="80px"
|
||||
></el-table-column>
|
||||
<el-table-column label="规格名称">
|
||||
<template slot-scope="{row}">
|
||||
<el-input maxlength="50" placeholder="规格名称"
|
||||
v-model="row.name"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所需积分" width="150px">
|
||||
<template slot-scope="{row}">
|
||||
<el-input-number :max="9999" placeholder="所需积分"
|
||||
v-model="row.points"
|
||||
:min="1"
|
||||
style="width: 100%"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="排序" width="150px">
|
||||
<template slot-scope="{row}">
|
||||
<el-input-number :max="9999" placeholder="排序"
|
||||
v-model="row.specificationsSort"
|
||||
:min="1"
|
||||
style="width: 100%"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="图片">
|
||||
<template slot-scope="{row}">
|
||||
<file-upload :upload_number="5" :value.sync="row.imgUrl"
|
||||
accept=".jpg,.jpeg,.png"
|
||||
class="imgUrl"
|
||||
upload_result_type="url"
|
||||
complete_result upload_mode="file"
|
||||
upload_result_category="array"></file-upload>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100px">
|
||||
<template slot="header" slot-scope="scope">
|
||||
<el-button @click="pushBenefitGoodsSpecifications" icon="el-icon-plus"
|
||||
size="mini" type="primary">
|
||||
添加
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot-scope="{row,$index}">
|
||||
<el-button
|
||||
@click="formData.benefitGoodsSpecificationsList.splice($index, 1)"
|
||||
size="mini"
|
||||
type="danger">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary"
|
||||
@click="goodsSpecificationsVisibleDialog = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="邮寄发放配置"
|
||||
:visible.sync="postProvideConfigVisibleDialog"
|
||||
:close-on-click-modal="false"
|
||||
width="40%">
|
||||
<el-form :model="postProvideConfigFormData"
|
||||
label-width="110px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="choiceProvince" label="可邮寄省份">
|
||||
<el-select v-model="postProvideConfigFormData.choiceProvince"
|
||||
placeholder="请选择可邮寄省份" clearable filterable
|
||||
@change="choiceProvinceChange" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in provinceOptions"
|
||||
:key="item.label"
|
||||
:label="item.label"
|
||||
:value="item.label"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="choiceMunicipality" label="可邮寄市">
|
||||
<el-select v-model="postProvideConfigFormData.choiceMunicipality"
|
||||
placeholder="请选择可邮寄市" clearable filterable
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in municipalityOptions"
|
||||
:key="item.label"
|
||||
:label="item.label"
|
||||
:value="item.label">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary"
|
||||
@click="postProvideConfigVisibleDialog = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="添加门店地址"
|
||||
:visible.sync="goodsShopAddressVisibleDialog"
|
||||
:close-on-click-modal="false"
|
||||
width="50%">
|
||||
<el-table :data="formData.shopAddressList">
|
||||
<el-table-column
|
||||
label="序号"
|
||||
type="index"
|
||||
width="80px"
|
||||
></el-table-column>
|
||||
<el-table-column label="门店地址">
|
||||
<template slot-scope="{row}">
|
||||
<el-input placeholder="门店地址" v-model="row.name"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100px">
|
||||
<template slot="header" slot-scope="scope">
|
||||
<el-button @click="formData.shopAddressList.push({name:''})"
|
||||
icon="el-icon-plus"
|
||||
size="mini" type="primary">
|
||||
添加
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot-scope="{row,$index}">
|
||||
<el-button
|
||||
@click="formData.shopAddressList.splice($index, 1)"
|
||||
size="mini"
|
||||
type="danger">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary"
|
||||
@click="goodsShopAddressVisibleDialog = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
`,
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
goodsCategoryOneLevelOptions: [],
|
||||
goodsCategoryTwoLevelOptions: [],
|
||||
viewData: {},
|
||||
visibleDialog: false,
|
||||
goodsSpecificationsVisibleDialog: false,
|
||||
postProvideConfigVisibleDialog: false,
|
||||
goodsShopAddressVisibleDialog: false,
|
||||
provinceOptions: chengShiList,
|
||||
municipalityOptions: [],
|
||||
postProvideConfigFormData: { choiceProvince: "", choiceMunicipality: "" },
|
||||
formRules: {
|
||||
name: [{ required: true, message: "必填", trigger: "blur" }],
|
||||
money: [{ required: true, message: "必填", trigger: "blur" }],
|
||||
goodsCategoryOneLevelId: [{ required: true, message: "必填", trigger: "blur" }],
|
||||
goodsCategoryTwoLevelId: [{ required: true, message: "必填", trigger: "blur" }],
|
||||
goodsSort: [{ required: true, message: "必填", trigger: "blur" }],
|
||||
goodsProvideMode: [{ required: true, message: "必填", trigger: "blur" }],
|
||||
description: [{ required: true, message: "必填", trigger: "blur" }]
|
||||
}
|
||||
}
|
||||
}, methods: {
|
||||
choiceProvinceChange(val) {
|
||||
this.$set(this.postProvideConfigFormData, "choiceMunicipality", "")
|
||||
this.municipalityOptions = chengShiList.find(v => v.label === val)?.children
|
||||
},
|
||||
goodsCategoryOneLevelChange(val) {
|
||||
this.$set(this.formData, "goodsCategoryTwoLevelId", "")
|
||||
this.goodsCategoryTwoLevelOptions = this.goodsCategoryOneLevelOptions.find(v => v.id === val)?.children
|
||||
},
|
||||
pushBenefitGoodsSpecifications() {
|
||||
this.formData.benefitGoodsSpecificationsList.push({
|
||||
name: "",
|
||||
specificationsSort: this.formData.benefitGoodsSpecificationsList.length + 1,
|
||||
imgUrl: ""
|
||||
})
|
||||
},
|
||||
async open() {
|
||||
this.formData = {
|
||||
status: 1,
|
||||
benefitGoodsSpecificationsList: [],
|
||||
shopAddressList: [],
|
||||
postProvideConfig: { choiceProvince: "", choiceMunicipality: "" },
|
||||
isHomepage:false
|
||||
}
|
||||
this.visibleDialog = true
|
||||
await this.getGoodsCategoryTree()
|
||||
},
|
||||
async findOne(id) {
|
||||
const res = await this.$axios.post("/platform/benefit/goods/findOne", { id })
|
||||
if (res.code === 0) {
|
||||
return res.data
|
||||
}
|
||||
},
|
||||
async openEdit(id) {
|
||||
const data = await this.findOne(id)
|
||||
data.imgUrl = JSON.parse(data.imgUrl)
|
||||
data.carouselImgUrl = JSON.parse(data.carouselImgUrl)
|
||||
data.shopAddressList = JSON.parse(data.shopAddressList)
|
||||
this.formData = data
|
||||
this.postProvideConfigFormData = JSON.parse(this.formData.postProvideConfig)
|
||||
this.visibleDialog = true
|
||||
await this.getGoodsCategoryTree()
|
||||
this.goodsCategoryTwoLevelOptions = this.goodsCategoryOneLevelOptions.find(v => v.id === this.formData.goodsCategoryOneLevelId)?.children
|
||||
},
|
||||
async getGoodsCategoryTree() {
|
||||
const res = await this.$axios.post("/platform/benefit/goods/getGoodsCategoryTree")
|
||||
this.goodsCategoryOneLevelOptions = res.data
|
||||
this.goodsCategoryTwoLevelOptions = []
|
||||
},
|
||||
submit() {
|
||||
this.$refs.formRef.validate(valid => {
|
||||
if (valid) {
|
||||
if (this.formData.goodsProvideMode=="GOODS_PROVIDE_MODE_SHOPPING"&&this.formData.benefitGoodsSpecificationsList.length==0){
|
||||
this.$message.warning("发放形式为商城兑换的商品需要设置商品规格")
|
||||
return
|
||||
}
|
||||
this.formData.postProvideConfig = this.postProvideConfigFormData
|
||||
this.$axios.post("/platform/benefit/goods/submit", { data: JSON.stringify(this.formData) }).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success("保存成功")
|
||||
this.visibleDialog = false
|
||||
this.$emit("query")
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
<!--#include("/platform/zhgh/welfare/include/chengSh.js"){}#-->
|
||||
@@ -0,0 +1,127 @@
|
||||
let BENEFIT_GOODS_INFO = {
|
||||
/*language=HTML*/
|
||||
template: `
|
||||
<div>
|
||||
<el-dialog title="查看商品"
|
||||
:visible.sync="visibleDialog" :close-on-click-modal="false" width="70%">
|
||||
<el-form label-width="110px">
|
||||
<el-descriptions :column="3" border>
|
||||
<el-descriptions-item label="商品名称">{{ viewData.name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="所需积分">{{ viewData.money }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="发放形式">
|
||||
<dict-tag :options="dict.type.BENEFIT_GOODS_PROVIDE_MODE"
|
||||
:value="viewData.goodsProvideMode"></dict-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="所属一级分类">
|
||||
{{ viewData.goodsCategoryOneLevelName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="所属二级分类">
|
||||
{{ viewData.goodsCategoryTwoLevelName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="排序">{{ viewData.goodsSort }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="简短描述" span="3">{{ viewData.simpleDesc }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="商品规格" span="3">
|
||||
<el-table :data="viewData.benefitGoodsSpecificationsList">
|
||||
<el-table-column
|
||||
label="序号"
|
||||
type="index"
|
||||
width="80px"
|
||||
></el-table-column>
|
||||
<el-table-column label="规格名称" prop="name">
|
||||
</el-table-column>
|
||||
<el-table-column label="图片">
|
||||
<template v-slot="{row}">
|
||||
<el-button @click="openImg(row.imgUrl)" size="mini"
|
||||
type="primary" v-if="row.imgUrl">
|
||||
点击查看图片
|
||||
</el-button>
|
||||
<span v-else>暂无</span>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="邮寄发放配置" span="3"
|
||||
v-if="viewData.goodsProvideMode==='BENEFIT_GOODS_PROVIDE_MODE_POST'">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="choiceProvince" label="可邮寄省份">
|
||||
{{
|
||||
viewData.postProvideConfig.choiceProvince?viewData.postProvideConfig.choiceProvince:'暂无'
|
||||
}}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="choiceProvince" label="可邮寄市">
|
||||
{{
|
||||
viewData.postProvideConfig.choiceMunicipality?viewData.postProvideConfig.choiceMunicipality:'暂无'
|
||||
}}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="说明描述" span="3">
|
||||
<div class="text-left" v-html="viewData.description"></div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="图片" span="3">
|
||||
<file-preview :files="viewData.imgUrl" complete_result></file-preview>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="是否主页" span="3">
|
||||
<span v-if="viewData.isHomepage">是</span>
|
||||
<span v-else>否</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="图片" span="3">
|
||||
<file-preview :files="viewData.carouselImgUrl" complete_result></file-preview>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary"
|
||||
@click="visibleDialog = false">关闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="查看商品"
|
||||
:visible.sync="imgVisibleDialog" :close-on-click-modal="false" width="50%">
|
||||
<file-preview :files="imgUrlList" complete_result></file-preview>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary"
|
||||
@click="imgVisibleDialog = false">关闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
`,
|
||||
dicts: ["BENEFIT_GOODS_PROVIDE_MODE"],
|
||||
data() {
|
||||
return {
|
||||
viewData: {},
|
||||
imgUrlList: [],
|
||||
visibleDialog: false,
|
||||
imgVisibleDialog: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openImg(imgUrl) {
|
||||
this.imgUrlList = imgUrl
|
||||
this.imgVisibleDialog = true
|
||||
},
|
||||
async findOne(id) {
|
||||
const res = await this.$axios.post("/platform/benefit/goods/findOne", { id })
|
||||
if (res.code === 0) {
|
||||
return res.data
|
||||
}
|
||||
},
|
||||
async open(id) {
|
||||
const data = await this.findOne(id)
|
||||
data.imgUrl = JSON.parse(data.imgUrl)
|
||||
this.viewData = data
|
||||
this.postProvideConfigFormData = JSON.parse(this.viewData.postProvideConfig)
|
||||
this.visibleDialog = true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="所属年份">
|
||||
<el-date-picker
|
||||
:clearable="false"
|
||||
placeholder="所属年份"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
@change="getWelfareList"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy"
|
||||
></el-date-picker>
|
||||
</search-item>
|
||||
|
||||
<search-item label="福利项目">
|
||||
<el-select :clearable="true" filterable placeholder="请选择福利项目" style="width: 100%" v-model="pageForm.benefitId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in projectSelectOptions"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never">
|
||||
<table-tool label="商品管理">
|
||||
<el-button @click="openAdd()" icon="el-icon-plus" size="mini" type="primary">新增商品</el-button>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" @sort-change="pageOrder" ref="table" row-key="id" v-loading="tableLoading">
|
||||
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
:key="column.prop"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
min-width="100px"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template v-slot="{row}" v-if="column.prop==='goodsProvideMode'">
|
||||
<dict-tag :options="dict.type.BENEFIT_GOODS_PROVIDE_MODE" :value="row.goodsProvideMode"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="300px">
|
||||
<template slot-scope="{row}">
|
||||
<el-button @click="openView(row)" size="mini" type="primary">查看</el-button>
|
||||
<el-button @click="openEdit(row)" size="mini" type="primary">编辑</el-button>
|
||||
<el-button @click="doDelete(row)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
<benefit-goods-form ref="benefitGoodsForm" @query="pageData"></benefit-goods-form>
|
||||
<benefit-goods-info ref="benefitGoodsInfo"></benefit-goods-info>
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include("goodsForm.js"){}#-->
|
||||
<!--#include("goodsInfo.js"){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
dicts: ["BENEFIT_GOODS_PROVIDE_MODE"],
|
||||
data() {
|
||||
return {
|
||||
projectSelectOptions: [],
|
||||
pageForm: {
|
||||
year: moment().format("YYYY")
|
||||
},
|
||||
tableColumns: [
|
||||
{ prop: "name", label: "商品名称" },
|
||||
{ prop: "simpleDesc", label: "简短描述" },
|
||||
{ prop: "goodsCategoryOneLevelName", label: "所属一级分类" },
|
||||
{ prop: "goodsCategoryTwoLevelName", label: "所属二级分类" },
|
||||
{ prop: "money", label: "所需积分" },
|
||||
{ prop: "goodsProvideMode", label: "发放形式" }
|
||||
]
|
||||
}
|
||||
},
|
||||
components: {
|
||||
"benefit-goods-form": BENEFIT_GOODS_FORM,
|
||||
"benefit-goods-info": BENEFIT_GOODS_INFO
|
||||
},
|
||||
methods: {
|
||||
openView(row) {
|
||||
this.$refs.benefitGoodsInfo.open(row.id)
|
||||
},
|
||||
openAdd() {
|
||||
this.$refs.benefitGoodsForm.open()
|
||||
},
|
||||
openEdit(row) {
|
||||
this.$refs.benefitGoodsForm.openEdit(row.id)
|
||||
},
|
||||
doDelete(row) {
|
||||
this.$confirm("确定要删除【" + row.name + "】?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios
|
||||
.post(loc() + "/delete", {
|
||||
id: row.id
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
getWelfareList() {
|
||||
this.$set(this.pageForm, "benefitId", "")
|
||||
this.$axios.post("/platform/benefit/project/getBenefitList", { year: this.pageForm.year }).then((res) => {
|
||||
this.projectSelectOptions = res.data
|
||||
})
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.getWelfareList()
|
||||
await this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
.benefitGoodsForm .el-form-item {
|
||||
margin-bottom: 5px !important;
|
||||
}
|
||||
</style>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,133 @@
|
||||
const BENEFIT_GOODS_CATEGORY_FORM_COMPONENT = {
|
||||
/*language=HTML*/
|
||||
template: `
|
||||
<el-dialog :title="formData.id ? '编辑菜单' : '新增菜单'" :show-close="false" :visible.sync="visibleDialog"
|
||||
:close-on-click-modal="false" width="35%">
|
||||
<el-form :model="formData" ref="formRef" :rules="formRules" size="small" label-width="120px">
|
||||
<el-row :gutter="60">
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="name" label="类型名称">
|
||||
<el-input maxlength="100" placeholder="类型名称" v-model="formData.name"
|
||||
type="text"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="parentId" label="上级类型">
|
||||
<el-cascader
|
||||
:options="menuOptions"
|
||||
:props="props"
|
||||
v-model="parentMenu"
|
||||
placeholder="不选择则为顶级"
|
||||
clearable
|
||||
style="width: 100%">
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="sort" label="排序值">
|
||||
<el-input-number v-model="formData.sort" controls-position="right" :min="1" :max="100">
|
||||
</el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="icon" label="类型图标">
|
||||
<file-upload
|
||||
:value.sync="formData.icon"
|
||||
:upload_number="1"
|
||||
upload_mode="image"
|
||||
upload_result_category="interval"
|
||||
upload_result_type="url">
|
||||
</file-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="status" label="启用状态">
|
||||
<el-switch v-model="formData.status" active-color="#ff4949"
|
||||
inactive-color="#13ce66"></el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visibleDialog = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
visibleDialog: false,
|
||||
formData: {},
|
||||
formRules: {
|
||||
name: [{ required: true, message: "必填", trigger: "blur" }]
|
||||
},
|
||||
menuOptions: [],
|
||||
parentMenu: [],
|
||||
props: {
|
||||
checkStrictly: true,
|
||||
multiple: false,
|
||||
label: "name",
|
||||
value: "id"
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onOpen(id) {
|
||||
this.visibleDialog = true
|
||||
this.formData = {}
|
||||
this.parentMenu = []
|
||||
this.menuOptions = []
|
||||
this.listFullTree()
|
||||
if (id == null) {
|
||||
this.formData = {}
|
||||
} else {
|
||||
this.detail(id)
|
||||
}
|
||||
},
|
||||
listFullTree() {
|
||||
this.$axios.post(loc() + "/getCategoryTree").then((res) => {
|
||||
this.menuOptions = res.data
|
||||
})
|
||||
},
|
||||
|
||||
detail(id) {
|
||||
this.$axios.post("/platform/benefit/goodsCategory/info", { id: id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.formData = res.data
|
||||
this.parentMenu = [res.data.parentId]
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.$refs.formRef.validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.parentMenu) {
|
||||
this.formData.parentId = this.parentMenu[this.parentMenu.length - 1] || ""
|
||||
} else {
|
||||
this.formData.parentId = ""
|
||||
}
|
||||
if (this.formData.status) {
|
||||
this.formData.status = 1
|
||||
} else {
|
||||
this.formData.status = 0
|
||||
}
|
||||
const { id } = this.formData
|
||||
const url = loc() + (id ? "/update" : "/save")
|
||||
|
||||
this.$axios
|
||||
.post(url, {
|
||||
benefitGoodsCategory: JSON.stringify(this.formData)
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success("保存成功")
|
||||
this.visibleDialog = false
|
||||
this.$emit("refresh", this.formData.parentId)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<div id="app" v-cloak>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="类型名称">
|
||||
<el-input v-model="pageForm.name" clearable placeholder="请填写名称查询" style="width: 100%"></el-input>
|
||||
</search-item>
|
||||
<search-item label="状态">
|
||||
<el-select v-model="pageForm.status" clearable placeholder="请选择状态">
|
||||
<el-option value="0" label="启用"></el-option>
|
||||
<el-option value="1" label="禁用"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool>
|
||||
<el-button @click="$refs.basicFormRef.onOpen(null)" size="small" type="primary" icon="el-icon-plus">新建类型</el-button>
|
||||
<!-- <el-button @click="$refs.sortRef.onOpen(pageForm.platform)" size="small" type="primary" icon="el-icon-sort">排序</el-button>-->
|
||||
</table-tool>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:highlight-current-row="true"
|
||||
:key="tableKey"
|
||||
:load="loadChild"
|
||||
:expand-row-keys="expandedRowKeysRenew"
|
||||
@expand-change="handleExpandChange"
|
||||
ref="tableData"
|
||||
style="width: 100%"
|
||||
lazy
|
||||
row-key="id"
|
||||
>
|
||||
<el-table-column align="left" header-align="left" label="类型名称" prop="name"></el-table-column>
|
||||
<el-table-column align="left" header-align="left" label="类型图标">
|
||||
<template slot-scope="scope">
|
||||
<el-image
|
||||
:preview-src-list="previewSrcList(scope.row.icon)"
|
||||
lazy
|
||||
:src="scope.row.icon"
|
||||
style="height: 30px; width: 30px"
|
||||
fit="cover"
|
||||
>
|
||||
<div slot="error" class="image-slot">
|
||||
<i class="el-icon-picture-outline"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" header-align="left" label="状态" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<i class="fa fa-circle text-danger ml5" v-if="scope.row.status==1"></i>
|
||||
<i class="fa fa-circle text-success ml5" v-if="scope.row.status==0"></i>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :show-overflow-tooltip="true" align="center" header-align="center" label="操作" prop="website" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-dropdown @command="dropdownCommand">
|
||||
<el-button size="mini">
|
||||
<i class="ti-settings"></i>
|
||||
<span class="ti-angle-down"></span>
|
||||
</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="{type:'enable',id:scope.row.id,name:scope.row.name,row:scope.row}" divided>
|
||||
启用
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="{type:'disable',id:scope.row.id,name:scope.row.name,row:scope.row}">禁用</el-dropdown-item>
|
||||
<el-dropdown-item :command="{type:'editMenu',id:scope.row.id,name:scope.row.name}">修改</el-dropdown-item>
|
||||
<el-dropdown-item :command="{type:'delete',id:scope.row.id,name:scope.row.name}">删除</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<basic-form ref="basicFormRef" @refresh="loadChildByExpandedKeys"></basic-form>
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include("basicForm.js"){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
components: {
|
||||
"basic-form": BENEFIT_GOODS_CATEGORY_FORM_COMPONENT
|
||||
// "permission-form": SYS_MENU_PERMISSION_FORM_COMPONENT,
|
||||
// sort: SYS_MENU_SORT_COMPONENT,
|
||||
// "quick-entry": SYS_MENU_QUICK_ENTRY_COMPONENT
|
||||
},
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
pageForm: {},
|
||||
tableData: [],
|
||||
tableKey: "",
|
||||
// 保存展开状态的数组
|
||||
expandedRowKeysRenew: [],
|
||||
tableTreeRefreshTool: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doSearch() {
|
||||
this.initTreeTable()
|
||||
},
|
||||
initTreeTable() {
|
||||
this.$axios
|
||||
.post("/platform/benefit/goodsCategory/child", {
|
||||
pid: "",
|
||||
...this.pageForm
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data
|
||||
this.tableKey = +new Date()
|
||||
}
|
||||
})
|
||||
},
|
||||
loadChild: function (tree, treeNode, resolve) {
|
||||
// 在之前声明的全局变量中,增加一个key为 本条数据的id,id可替换为你数据中的任意唯一值
|
||||
this.tableTreeRefreshTool[tree.id] = {}
|
||||
// 重要!保存resolve方法,以便后续使用
|
||||
this.tableTreeRefreshTool[tree.id].resolve = resolve
|
||||
// 记录展开次数,具体作用后续介绍
|
||||
this.tableTreeRefreshTool[tree.id].expandCount = 0
|
||||
const url = "/platform/benefit/goodsCategory/child"
|
||||
this.$axios.post(url, { pid: tree.id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
resolve(res.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
dropdownCommand(command) {
|
||||
//监听下拉框事件
|
||||
if ("editMenu" === command.type) {
|
||||
this.$refs.basicFormRef.onOpen(command.id)
|
||||
}
|
||||
if ("enable" === command.type || "disable" === command.type) {
|
||||
this.$axios.post("/platform/benefit/goodsCategory/" + command.type + "/" + command.id).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
if ("disable" === command.type) {
|
||||
command.row.status = 1
|
||||
}
|
||||
if ("enable" === command.type) {
|
||||
command.row.status = 0
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
if ("delete" === command.type) {
|
||||
this.$confirm("此操作将删除 " + command.name, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/benefit/goodsCategory/doDelete/" + command.id).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.loadChildByExpandedKeys(null)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
handleExpandChange(row, expanded) {
|
||||
if ((row.parentId === "" || row.parentId == null) && !expanded) {
|
||||
this.expandedRowKeysRenew = []
|
||||
return
|
||||
}
|
||||
if (expanded) {
|
||||
this.expandedRowKeysRenew.push(row.id)
|
||||
} else {
|
||||
const index = this.expandedRowKeysRenew.findIndex((v) => v === row.id)
|
||||
this.expandedRowKeysRenew.splice(index, 1)
|
||||
}
|
||||
},
|
||||
loadChildByExpandedKeys(parentId) {
|
||||
if (this.expandedRowKeysRenew && this.expandedRowKeysRenew.length > 0) {
|
||||
this.expandedRowKeysRenew.forEach((v) => {
|
||||
const curr = this.tableTreeRefreshTool[v]
|
||||
// api请求
|
||||
this.$axios.post("/platform/benefit/goodsCategory/child", { pid: v }).then((res) => {
|
||||
if (res.data.length == 0 || parentId == "") {
|
||||
this.initTreeTable()
|
||||
}
|
||||
curr.resolve(res.data)
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.initTreeTable()
|
||||
}
|
||||
},
|
||||
previewSrcList(url) {
|
||||
const previewSrcList = [url]
|
||||
return previewSrcList
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initTreeTable()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,8 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@@ -0,0 +1,107 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<div id="app">
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="下单时间">
|
||||
<el-date-picker
|
||||
style="width: 100%"
|
||||
:clearable="true"
|
||||
v-model="pageForm.orderTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择日期"
|
||||
></el-date-picker>
|
||||
</search-item>
|
||||
|
||||
<search-item label="商品名称">
|
||||
<el-input
|
||||
@keyup.enter.native="doSearch"
|
||||
clearable
|
||||
placeholder="请输入商品名称"
|
||||
style="width: 100%"
|
||||
v-model="pageForm.goodsName"
|
||||
></el-input>
|
||||
</search-item>
|
||||
|
||||
<!-- <search-item label="规格名称">
|
||||
<el-input
|
||||
@keyup.enter.native="doSearch"
|
||||
clearable
|
||||
placeholder="请输入内容"
|
||||
style="width: 100%"
|
||||
v-model="pageForm.specName"
|
||||
></el-input>
|
||||
</search-item>-->
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never">
|
||||
<table-tool label="商品订单管理"></table-tool>
|
||||
<el-table :data="tableData" ref="table" row-key="id" v-loading="tableLoading">
|
||||
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
|
||||
<el-table-column label="商品名称" prop="goodsName"></el-table-column>
|
||||
<el-table-column label="商品规格" prop="specName"></el-table-column>
|
||||
<el-table-column label="收货地址" prop="receiveAddress"></el-table-column>
|
||||
<el-table-column label="下单时间" prop="orderTime"></el-table-column>
|
||||
<el-table-column label="操作" width="200px">
|
||||
<template slot-scope="{row}">
|
||||
<el-button @click="doDelete(row)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
</guava>
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
pageForm: {},
|
||||
tableData: [],
|
||||
tableLoading: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doDelete(row) {
|
||||
this.$confirm("确定要删除【" + row.userName + "】?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios
|
||||
.post("/platform/benefit/order/deleteOrder", {
|
||||
id: row.id
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
openView(row) {}
|
||||
/*pageData() {
|
||||
this.tableLoading = true
|
||||
const pageForm = clone(this.pageForm)
|
||||
this.$axios.post(loc() + "/pageData", pageForm).then((res) => {
|
||||
this.tableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
})
|
||||
}*/
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,225 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<div id="app" v-cloak>
|
||||
<guava :edit_scroll="false" ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="所属年份">
|
||||
<el-date-picker
|
||||
:clearable="true"
|
||||
placeholder="所属年份"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
@change="getWelfareList"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy"
|
||||
></el-date-picker>
|
||||
</search-item>
|
||||
|
||||
<search-item label="福利项目">
|
||||
<el-select filterable :clearable="true" placeholder="请选择福利项目" style="width: 100%" v-model="pageForm.benefitId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in projectSelectOptions"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never">
|
||||
<table-tool label="福利项目">
|
||||
<el-button @click="openAdd()" icon="el-icon-plus" size="mini" type="primary">新增项目</el-button>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" @sort-change="pageOrder" ref="table" row-key="id" v-loading="tableLoading">
|
||||
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
:key="column.prop"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
min-width="100px"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template v-slot="{row}" v-if="column.prop==='startChoiceTime'">
|
||||
{{$moment(row.startChoiceTime).format("YYYY-MM-DD HH:mm")}}
|
||||
</template>
|
||||
<template v-slot="{row}" v-else-if="column.prop==='endChoiceTime'">
|
||||
{{$moment(row.startChoiceTime).format("YYYY-MM-DD HH:mm")}}
|
||||
</template>
|
||||
<template v-slot="{row}" v-else-if="column.prop==='provideMode'">
|
||||
<dict-tag :options="dict.type.BENEFIT_PROVIDE_MODE" :value="row.provideMode"></dict-tag>
|
||||
</template>
|
||||
<template v-slot="{row}" v-else-if="column.prop==='signMode'">
|
||||
<dict-tag :options="dict.type.BENEFIT_SIGN_MODE" :value="row.signMode"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="550px">
|
||||
<template slot-scope="{row}">
|
||||
<template v-if="row.isUnseal">
|
||||
<el-button
|
||||
@click="createBenefitUser(row)"
|
||||
:loading="submitLoading"
|
||||
size="mini"
|
||||
type="primary"
|
||||
v-if="row.benefitUserNum===0"
|
||||
>
|
||||
生成福利名单
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="renewBenefitUser(row,true)"
|
||||
:loading="submitLoading"
|
||||
size="mini"
|
||||
type="primary"
|
||||
v-if="row.benefitUserNum>0"
|
||||
>
|
||||
更新福利名单
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="renewBenefitUser(row,false)"
|
||||
:loading="submitLoading"
|
||||
size="mini"
|
||||
type="primary"
|
||||
v-if="row.benefitUserNum>0"
|
||||
>
|
||||
重置福利名单
|
||||
</el-button>
|
||||
<el-button @click="doEdit(row.id,false)" size="mini" type="danger">关闭</el-button>
|
||||
</template>
|
||||
<template v-if="!row.isUnseal">
|
||||
<el-button @click="doEdit(row.id,true)" size="mini" type="primary">开启</el-button>
|
||||
</template>
|
||||
|
||||
<el-button @click="openView(row)" size="mini" type="primary">查看</el-button>
|
||||
<el-button @click="openEdit(row)" size="mini" type="primary">编辑</el-button>
|
||||
<el-button @click="doDelete(row)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
<benefit-project-form ref="benefitProjectForm" @query="pageData"></benefit-project-form>
|
||||
<benefit-project-info ref="benefitInfo"></benefit-project-info>
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include("projectForm.js"){}#-->
|
||||
<!--#include("projectInfo.js"){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
dicts: ["BENEFIT_PROVIDE_MODE", "BENEFIT_SIGN_MODE"],
|
||||
data() {
|
||||
return {
|
||||
pageForm: {
|
||||
year: moment().format("YYYY")
|
||||
},
|
||||
projectSelectOptions: [],
|
||||
tableColumns: [
|
||||
{ prop: "name", label: "项目名称" },
|
||||
{ prop: "festival", label: "发放节日" },
|
||||
{ prop: "startChoiceTime", label: "选择开始时间" },
|
||||
{ prop: "endChoiceTime", label: "选择结束时间" },
|
||||
{ prop: "provideMode", label: "发放形式" },
|
||||
{ prop: "signMode", label: "是否电子签字" }
|
||||
]
|
||||
}
|
||||
},
|
||||
components: {
|
||||
"benefit-project-form": BENEFIT_PROJECT_FORM,
|
||||
"benefit-project-info": BENEFIT_PROJECT_INFO
|
||||
},
|
||||
methods: {
|
||||
doEdit(id, isUnseal) {
|
||||
this.submitLoading = true
|
||||
this.$axios.post("/platform/benefit/project/doEdit", { id, isUnseal }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success("更新成功")
|
||||
this.pageData()
|
||||
}
|
||||
this.submitLoading = false
|
||||
})
|
||||
},
|
||||
renewBenefitUser(row, isRenew) {
|
||||
this.$confirm("确定要" + (isRenew ? "更新" : "重置") + "福利名单吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.submitLoading = true
|
||||
this.$axios.post("/platform/benefit/project/renewBenefitUser", { benefitId: row.id, isRenew: isRenew }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success("更新成功")
|
||||
this.pageData()
|
||||
}
|
||||
this.submitLoading = false
|
||||
})
|
||||
})
|
||||
},
|
||||
createBenefitUser(row) {
|
||||
this.$confirm("确定要生成福利名单吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.submitLoading = true
|
||||
this.$axios.post("/platform/benefit/project/createBenefitUser", { benefitId: row.id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success("生成成功")
|
||||
this.pageData()
|
||||
this.submitLoading = false
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
openView(row) {
|
||||
this.$refs.benefitInfo.open(row.id)
|
||||
},
|
||||
openEdit(row) {
|
||||
this.$refs.benefitProjectForm.openEdit(row.id)
|
||||
},
|
||||
doDelete(row) {
|
||||
this.$confirm("确定要删除【" + row.name + "】?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
this.$axios.post("/platform/benefit/project/delete", { id: row.id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success("删除成功")
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
openAdd() {
|
||||
this.$refs.benefitProjectForm.open()
|
||||
},
|
||||
getWelfareList() {
|
||||
this.$set(this.pageForm, "benefitId", "")
|
||||
this.$axios.post("/platform/benefit/project/getBenefitList", { year: this.pageForm.year }).then((res) => {
|
||||
this.projectSelectOptions = res.data
|
||||
})
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.getWelfareList()
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.benefitProjectForm .el-form-item {
|
||||
margin-bottom: 5px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,298 @@
|
||||
<!--#include("../goods/goodsInfo.js"){}#-->
|
||||
let BENEFIT_PROJECT_FORM = {
|
||||
/*language=HTML*/
|
||||
template: `
|
||||
<div>
|
||||
<el-dialog :title="formData.id ? '编辑项目' : '新增项目'"
|
||||
:visible.sync="visibleDialog" :close-on-click-modal="false" width="60%">
|
||||
<el-form :model="formData" ref="formRef" :rules="formRules"
|
||||
label-width="0" class="benefitProjectForm">
|
||||
<el-descriptions border class="descriptions-form" :column="3">
|
||||
<el-descriptions-item label="项目名称" span="3">
|
||||
<el-form-item prop="name" label="">
|
||||
<el-input maxlength="40" placeholder="项目名称" show-word-limit
|
||||
v-model="formData.name"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="发放节日">
|
||||
<el-form-item label="" prop="festival">
|
||||
<dict-select clearable code="BENEFIT_FESTIVAL"
|
||||
placeholder="请选择发放节日"
|
||||
v-model="formData.festival"></dict-select>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="选择时间" span="2">
|
||||
<el-form-item label="" prop="choiceTime">
|
||||
<el-date-picker
|
||||
@change="choiceTimeChange"
|
||||
end-placeholder="结束时间"
|
||||
range-separator="-"
|
||||
start-placeholder="开始时间"
|
||||
style="width: 100%"
|
||||
type="datetimerange"
|
||||
v-model="formData.choiceTime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
|
||||
<el-descriptions-item label="是否电子签字" span="1.5">
|
||||
<el-form-item label="" prop="signMode">
|
||||
<el-radio-group size="medium" v-model="formData.signMode">
|
||||
<el-radio-button :key="item.code" :label="item.code"
|
||||
v-for="item in dict.type.BENEFIT_SIGN_MODE">
|
||||
{{item.name}}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="发放形式" span="1.5">
|
||||
<el-form-item label="" prop="provideMode">
|
||||
<el-radio-group size="medium" v-model="formData.provideMode"
|
||||
@change="provideModeChange">
|
||||
<el-radio-button :key="item.code" :label="item.code"
|
||||
v-for="item in dict.type.BENEFIT_PROVIDE_MODE">
|
||||
{{item.name}}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<template v-if="formData.provideMode==='BENEFIT_PROVIDE_MODE_TWO'">
|
||||
<el-descriptions-item label="逾期选择时间" span="1.5">
|
||||
<el-form-item label="" prop="endOverdueChoiceTime">
|
||||
<el-date-picker
|
||||
placeholder="逾期未选择最后选择截至时间"
|
||||
style="width: 100%"
|
||||
type="datetime"
|
||||
v-model="formData.endOverdueChoiceTime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="福利总积分" span="1.5">
|
||||
<el-form-item label="" prop="totalMoney">
|
||||
<el-input-number v-model="formData.totalMoney" :precision="2"
|
||||
:max="99999" :min="1"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
</template>
|
||||
|
||||
|
||||
<el-descriptions-item label="福利礼品" span="3"
|
||||
v-if="formData.provideMode==='BENEFIT_PROVIDE_MODE_ONE'">
|
||||
<el-form-item label="" prop="giftName">
|
||||
<el-input maxlength="100" placeholder="福利礼品"
|
||||
suffix-icon="el-icon-present"
|
||||
v-model="formData.giftName"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="福利套餐" span="3"
|
||||
v-if="formData.provideMode==='BENEFIT_PROVIDE_MODE_TWO'">
|
||||
<el-cascader
|
||||
@change="goodsCategoryChange"
|
||||
:options="goodsCategoryOptions"
|
||||
:props="goodsCategoryProps"
|
||||
v-model="pageForm.goodsCategoryIds"
|
||||
placeholder="选择类型查询"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
></el-cascader>
|
||||
|
||||
<el-table
|
||||
:data="goodsTableData"
|
||||
ref="goodsTable"
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
v-loading="tableLoading">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
:reserve-selection="true"
|
||||
width="55">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:index="indexMethod"
|
||||
label="序号"
|
||||
type="index"
|
||||
width="80px"
|
||||
></el-table-column>
|
||||
<el-table-column label="商品名称" prop="name"></el-table-column>
|
||||
<el-table-column label="所属一级分类"
|
||||
prop="goodsCategoryOneLevelName"></el-table-column>
|
||||
<el-table-column label="所属二级分类"
|
||||
prop="goodsCategoryTwoLevelName"></el-table-column>
|
||||
<el-table-column label="所需积分" prop="money"></el-table-column>
|
||||
<el-table-column label="发放形式" prop="goodsProvideMode">
|
||||
<template v-slot="{row}">
|
||||
<dict-tag :options="dict.type.BENEFIT_GOODS_PROVIDE_MODE"
|
||||
:value="row.goodsProvideMode"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="100px">
|
||||
<template slot-scope="{row}">
|
||||
<el-button @click="openViewGoods(row.id)" size="mini"
|
||||
type="primary">查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
|
||||
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="封面图片" span="3">
|
||||
<el-form-item label="" prop="cover">
|
||||
<file-upload
|
||||
:value.sync="formData.cover"
|
||||
:upload_number="1"
|
||||
upload_mode="image"
|
||||
upload_result_category="interval"
|
||||
upload_result_type="url"
|
||||
></file-upload>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
</el-descriptions>
|
||||
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visibleDialog = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">提 交</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<benefit-goods-info ref="benefitGoodsInfo"></benefit-goods-info>
|
||||
</div>
|
||||
`,
|
||||
dicts: ["BENEFIT_PROVIDE_MODE", "BENEFIT_SIGN_MODE", "BENEFIT_GOODS_PROVIDE_MODE"],
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
visibleDialog: false,
|
||||
goodsTableData: [],
|
||||
goodsCategoryOptions: [],
|
||||
goodsCategoryProps: {
|
||||
checkStrictly: true,
|
||||
multiple: false,
|
||||
label: "name",
|
||||
value: "id"
|
||||
},
|
||||
formRules: {
|
||||
name: [{ required: true, message: "必填", trigger: "blur" }],
|
||||
totalMoney: [{ required: true, message: "必填", trigger: "blur" }],
|
||||
giftName: [{ required: true, message: "必填", trigger: "blur" }],
|
||||
festival: [{ required: true, message: "必填", trigger: "blur" }]
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
"benefit-goods-info": BENEFIT_GOODS_INFO
|
||||
},
|
||||
methods: {
|
||||
choiceTimeChange(val) {
|
||||
if (val) {
|
||||
this.$set(this.formData, "startChoiceTime", val[0])
|
||||
this.$set(this.formData, "endChoiceTime", val[1])
|
||||
}
|
||||
},
|
||||
submit() {
|
||||
this.$refs.formRef.validate(valid => {
|
||||
console.log(this.formData.benefitGoodsIds)
|
||||
if (valid) {
|
||||
if (this.formData.provideMode === "BENEFIT_PROVIDE_MODE_TWO" && this.formData.benefitGoodsIds && this.formData.benefitGoodsIds.length === 0) {
|
||||
this.$message.error("请选择福利商品")
|
||||
return
|
||||
}
|
||||
this.$axios.post("/platform/benefit/project/submit", {
|
||||
data: JSON.stringify(this.formData),
|
||||
benefitGoodsIds: this.formData.benefitGoodsIds
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success("保存成功")
|
||||
this.visibleDialog = false
|
||||
this.$emit("query")
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
provideModeChange() {
|
||||
if (this.formData.provideMode === "BENEFIT_PROVIDE_MODE_TWO") {
|
||||
this.pageData()
|
||||
this.getCategoryTree()
|
||||
}
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
// 使用 Map 来存储唯一的 id 和对应的对象
|
||||
const data = new Map(val.map(item => [item.id, item]))
|
||||
// 将 Map 的值转换回数组
|
||||
const newData = Array.from(data.values())
|
||||
this.formData.benefitGoodsIds = newData.map(v => v.id)
|
||||
},
|
||||
getCategoryTree() {
|
||||
this.$axios.post("/platform/benefit/project/getCategoryTree").then((res) => {
|
||||
this.goodsCategoryOptions = res.data
|
||||
})
|
||||
},
|
||||
goodsCategoryChange(val) {
|
||||
this.pageForm.goodsCategoryIds = val
|
||||
this.pageData()
|
||||
},
|
||||
pageData() {
|
||||
this.pageForm.benefitId = this.formData.id
|
||||
this.$axios.post("/platform/benefit/project/getGoodsTableData", { pageForm: JSON.stringify(this.pageForm) }).then((res) => {
|
||||
this.tableLoading = false
|
||||
this.goodsTableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
this.toggleRowSelection()
|
||||
})
|
||||
},
|
||||
openViewGoods(id) {
|
||||
this.$refs.benefitGoodsInfo.open(id)
|
||||
},
|
||||
async findOne(id) {
|
||||
const res = await this.$axios.post("/platform/benefit/project/findOne", { id })
|
||||
if (res.code === 0) {
|
||||
return res.data
|
||||
}
|
||||
},
|
||||
toggleRowSelection() {
|
||||
this.formData.benefitGoodsList.forEach((v) => {
|
||||
if (v.benefitId) {
|
||||
const index = this.goodsTableData.findIndex((item) => item.id === v.id)
|
||||
if (index !== -1) {
|
||||
this.$refs.goodsTable.toggleRowSelection(this.goodsTableData[index])
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
async openEdit(id) {
|
||||
this.visibleDialog = true
|
||||
const data = await this.findOne(id)
|
||||
this.formData = data
|
||||
this.pageForm.isEdit = true
|
||||
this.$set(this.formData, "choiceTime", [data.startChoiceTime, data.endChoiceTime])
|
||||
this.pageData()
|
||||
this.getCategoryTree()
|
||||
this.$nextTick(() => {
|
||||
this.$refs.goodsTable.clearSelection();
|
||||
})
|
||||
},
|
||||
async open() {
|
||||
this.formData = {
|
||||
signMode: "BENEFIT_SIGN_MODE_ONE",
|
||||
provideMode: "BENEFIT_PROVIDE_MODE_ONE",
|
||||
benefitGoodsIds: []
|
||||
}
|
||||
this.$set(this.pageForm, "isEdit", true)
|
||||
this.$set(this.pageForm, "benefitGoodsIds", [])
|
||||
this.visibleDialog = true
|
||||
this.$refs.goodsTable.clearSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
let BENEFIT_PROJECT_INFO = {
|
||||
/*language=HTML*/
|
||||
template: `
|
||||
<div>
|
||||
<el-dialog title="查看项目详情"
|
||||
:visible.sync="visibleDialog" :close-on-click-modal="false" width="60%">
|
||||
<el-descriptions border class="descriptions-form" :column="3">
|
||||
<el-descriptions-item label="项目名称" span="3">
|
||||
{{viewData.name}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="发放节日">
|
||||
<dict-tag :options="dict.type.BENEFIT_FESTIVAL"
|
||||
:value="viewData.festival"></dict-tag>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="选择时间" span="2">
|
||||
{{viewData.startChoiceTime}}至{{viewData.endChoiceTime}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="是否电子签字" span="1.5">
|
||||
<dict-tag :options="dict.type.BENEFIT_SIGN_MODE"
|
||||
:value="viewData.signMode"></dict-tag>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="发放形式" span="1.5">
|
||||
<dict-tag :options="dict.type.BENEFIT_PROVIDE_MODE"
|
||||
:value="viewData.provideMode"></dict-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="逾期选择时间" span="1.5">
|
||||
{{viewData.endOverdueChoiceTime}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="福利总积分" span="1.5"
|
||||
v-if="viewData.provideMode==='BENEFIT_PROVIDE_MODE_TWO'">
|
||||
{{viewData.totalMoney}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="" span="1.5"
|
||||
v-if="viewData.provideMode==='BENEFIT_PROVIDE_MODE_ONE'">
|
||||
</el-descriptions-item>
|
||||
|
||||
|
||||
<el-descriptions-item label="福利礼品" span="3"
|
||||
v-if="viewData.provideMode==='BENEFIT_PROVIDE_MODE_ONE'">
|
||||
{{viewData.giftName}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="福利套餐" span="3"
|
||||
v-if="viewData.provideMode==='BENEFIT_PROVIDE_MODE_TWO'">
|
||||
<el-table
|
||||
:data="goodsTableData"
|
||||
ref="goodsTable"
|
||||
row-key="id"
|
||||
v-loading="tableLoading">
|
||||
<el-table-column
|
||||
:index="indexMethod"
|
||||
label="序号"
|
||||
type="index"
|
||||
width="80px"
|
||||
></el-table-column>
|
||||
<el-table-column label="商品名称" prop="name"></el-table-column>
|
||||
<el-table-column label="所属一级分类"
|
||||
prop="goodsCategoryOneLevelName"></el-table-column>
|
||||
<el-table-column label="所属二级分类"
|
||||
prop="goodsCategoryTwoLevelName"></el-table-column>
|
||||
<el-table-column label="所需积分" prop="money"></el-table-column>
|
||||
<el-table-column label="发放形式" prop="goodsProvideMode">
|
||||
<template v-slot="{row}">
|
||||
<dict-tag :options="dict.type.BENEFIT_GOODS_PROVIDE_MODE"
|
||||
:value="row.goodsProvideMode"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="封面图片" span="3">
|
||||
<file-preview :files="viewData.cover"></file-preview>
|
||||
</el-descriptions-item>
|
||||
|
||||
</el-descriptions>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visibleDialog = false">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
`,
|
||||
dicts: ["BENEFIT_FESTIVAL", "BENEFIT_SIGN_MODE", "BENEFIT_PROVIDE_MODE", "BENEFIT_GOODS_PROVIDE_MODE"],
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
visibleDialog: false,
|
||||
goodsTableData: []
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
methods: {
|
||||
async findOne(id) {
|
||||
const res = await this.$axios.post("/platform/benefit/project/findOne", { id })
|
||||
if (res.code === 0) {
|
||||
return res.data
|
||||
}
|
||||
},
|
||||
|
||||
pageData() {
|
||||
this.pageForm.benefitId = this.viewData.id
|
||||
this.pageForm.isEdit = false
|
||||
this.$axios.post("/platform/benefit/project/getGoodsTableData", { pageForm: JSON.stringify(this.pageForm) }).then((res) => {
|
||||
this.tableLoading = false
|
||||
this.goodsTableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
})
|
||||
},
|
||||
async open(id) {
|
||||
const data = await this.findOne(id)
|
||||
this.viewData = data
|
||||
this.pageData()
|
||||
this.visibleDialog = true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,427 @@
|
||||
const BUY_INFO = {
|
||||
/*language=HTML*/
|
||||
template: `
|
||||
<el-dialog
|
||||
:append-to-body="true"
|
||||
:modal-append-to-body="false"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="dialogVisible"
|
||||
title="收货地址"
|
||||
@closed="onClose"
|
||||
width="70%">
|
||||
<span >
|
||||
<el-steps simple :space="200" :align-center="true" :active="active" finish-status="success">
|
||||
<el-step title="1.我的购物车"></el-step>
|
||||
<el-step title="2.填写核对订单信息"></el-step>
|
||||
<el-step title="3.成功提交订单"></el-step>
|
||||
</el-steps>
|
||||
</span>
|
||||
<template v-if="active==1">
|
||||
<div class="content shopCart">
|
||||
<el-empty v-if="cartList.length==0" image="https://image30.xedaojia.net/upload/wechat/images/flash/flashcart-empty.png">
|
||||
<el-button type="text" @click="dialogVisible = false">购物车空空的哦~,去看看心仪的商品吧~</el-button>
|
||||
</el-empty>
|
||||
<!-- table -->
|
||||
<div class="table" v-else>
|
||||
<el-table element-loading-text="正在为您拼命加载中..." :data="cartList" ref="multipleTable"
|
||||
style="width: 100%;"
|
||||
:border="false"
|
||||
row-key="id"
|
||||
:reserve-selection="true"
|
||||
@select-all="allSelectionChange"
|
||||
@select="checkSelectionChange"
|
||||
@selection-change="handleSelectionChange" :close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:header-cell-style="{background:'#f3f3f3',color:'#999'}">
|
||||
<el-table-column prop="isChecked" type="selection" width="75" align="center" />
|
||||
<el-table-column align="center" width="200" label="商品">
|
||||
<template slot-scope="scope">
|
||||
<img :src="scope.row.benefitGoodsSpecifications.imgUrl[0].url" class="shopImg" alt="">
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="shop" align="left">
|
||||
<template slot-scope="scope">
|
||||
<span class="shop">{{scope.row.benefitGoods.name}}</span>
|
||||
<span class="shop">{{scope.row.benefitGoodsSpecifications.name}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="200" prop="count" label="价格" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span class="count">¥{{scope.row.benefitGoodsSpecifications.points}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="120" label="操作" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="cartDelete(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<span v-if="cartList.length!=0" class="dialog-footer" slot="footer">
|
||||
<el-card style="margin-bottom: 20px" class="box-card" shadow="never">
|
||||
<div class="text item">
|
||||
<span class="desc">已选择:{{cartSelectList.length}}件商品</span>
|
||||
<span class="desc" style="padding-right: 10px">总价:</span><span class="cart-price">{{totalPrice}}</span>
|
||||
<el-button @click="submitCart" style="margin-left: 30px;margin-right: -10px;" type="danger">去结算</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="active==2">
|
||||
<div style="margin: 0 auto;">
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>收货人信息</span>
|
||||
<!--<el-button style="float: right; padding: 3px 0" type="text">新增收货地址</el-button>-->
|
||||
</div>
|
||||
<div class="text item">
|
||||
<el-descriptions v-for="(item,index) in count" :column="6" :colon="false">
|
||||
<el-descriptions-item>
|
||||
<el-button type="text" @click="openAddress" v-if="tableData[index].isDefault" :icon="icon"></el-button>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
{{tableData[index].userName}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>{{tableData[index].province}}{{tableData[index].city}}{{tableData[index].county}}</el-descriptions-item>
|
||||
<el-descriptions-item style="width: 100px">
|
||||
<el-tooltip class="item" effect="dark" :content="tableData[index].addressDetail" placement="top">
|
||||
<div class="ellipsis" >{{tableData[index].addressDetail}}</div>
|
||||
</el-tooltip>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>{{tableData[index].tel}}</el-descriptions-item>
|
||||
<el-descriptions-item >
|
||||
<el-button @click="doDefault(tableData[index])" v-if="!tableData[index].isDefault" type="text" style="padding-top: 0px;">设为默认地址</el-button>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>商品信息</span>
|
||||
</div>
|
||||
<div class="text item">
|
||||
<el-descriptions v-for="data in formData" :column="4" :colon="false">
|
||||
<el-descriptions-item>
|
||||
<el-image
|
||||
style="width: 80px;height: 80px;line-height: 80px"
|
||||
:src="data.imgUrl[0].url"
|
||||
fit="cover"></el-image>
|
||||
<span>{{data.goodsName}}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item><span style="height: 80px;line-height: 80px">{{data.name}}</span></el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<el-tooltip class="item" effect="dark" :content="data.simpleDesc" placement="top">
|
||||
<span class="ellipsis" style="width:300px;height: 80px;line-height: 80px">
|
||||
{{data.simpleDesc}}
|
||||
</span>
|
||||
</el-tooltip>
|
||||
</el-descriptions-item>
|
||||
</el-tooltip>
|
||||
|
||||
<el-descriptions-item><span class="price-show" style="height: 80px;line-height: 80px">{{data.points}}</span></el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
<span class="dialog-footer" slot="footer">
|
||||
<el-card style="background-color: #f4f4f4;margin-bottom: 20px" class="box-card" shadow="never">
|
||||
<div class="text item">
|
||||
<span style="padding-right: 10px">应付总额:</span><span class="price-show">{{calculateTotalPrice()}}</span>
|
||||
</div>
|
||||
<div class="text item" v-for="item in filterAddressIsDefault()">
|
||||
<span class="desc" style="padding-right: 10px;width: 400px">寄送至:{{item.province}}{{item.city}}{{item.county}}{{item.addressDetail}}</span>
|
||||
<span class="desc">收货人:{{item.userName}}{{item.tel}}</span>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button @click="submit" type="danger">提交所有订单</el-button>
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="active==3">
|
||||
<el-empty style="height: 500px" image="https://pc-b2b2c.pickmall.cn/static/img/pay-success.f880966f.png">
|
||||
<el-button type="primary" @click="dialogVisible = false">继续逛逛</el-button>
|
||||
</el-empty>
|
||||
</template>
|
||||
</el-dialog>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
formData: [],
|
||||
specificationsId: "",
|
||||
tableData: [],
|
||||
dialogVisible: false,
|
||||
active: 2,
|
||||
cartList: [],
|
||||
cartSelectList: [],
|
||||
totalPrice: 0,
|
||||
icon: "el-icon-arrow-right el-icon--right",
|
||||
count: 1
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onOpen(data, active) {
|
||||
this.formData = data
|
||||
this.dialogVisible = true
|
||||
this.active = active
|
||||
if (active == 1) {
|
||||
this.getCart()
|
||||
}
|
||||
this.getAddress()
|
||||
},
|
||||
onClose() {
|
||||
this.$emit("close_cart")
|
||||
},
|
||||
openAddress() {
|
||||
if (this.icon == "el-icon-arrow-right el-icon--right") {
|
||||
this.count = this.tableData.length
|
||||
this.icon = "el-icon-arrow-down"
|
||||
return
|
||||
}
|
||||
if (this.icon == "el-icon-arrow-down") {
|
||||
this.count = 1
|
||||
this.icon = "el-icon-arrow-right el-icon--right"
|
||||
return
|
||||
}
|
||||
},
|
||||
submit() {
|
||||
const address = this.filterAddressIsDefault()
|
||||
const cartId = []
|
||||
for (let i = 0; i < this.formData.length; i++) {
|
||||
if (this.formData[i].cartId != null) {
|
||||
cartId.push(this.formData[i].cartId)
|
||||
}
|
||||
}
|
||||
const benefitBuyGoodsVo = {
|
||||
list: JSON.stringify(this.formData),
|
||||
addressId: address[0].id,
|
||||
cartId: JSON.stringify(cartId)
|
||||
}
|
||||
this.$axios.post("/platform/benefit/shop/buyGoodsList", benefitBuyGoodsVo).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.active = 3
|
||||
} else {
|
||||
this.$message.warning(res.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
getAddress() {
|
||||
this.$axios.post("/platform/benefit/address/selectUserAddress", this.pageForm).then((resp) => {
|
||||
this.tableLoading = false
|
||||
if (resp.code === 0) {
|
||||
this.tableData = resp.data
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
async doDefault(row) {
|
||||
const resp = await this.$axios.post("/platform/benefit/address/doDefault", { id: row.id })
|
||||
if (resp.code === 0) {
|
||||
this.getAddress()
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: resp.msg
|
||||
})
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
},
|
||||
getCart() {
|
||||
this.$axios.post("/platform/benefit/shop/getCartList").then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
this.cartList = resp.data
|
||||
this.$nextTick(() => {
|
||||
this.cartList.forEach((el) => {
|
||||
if (el.isChecked == true) {
|
||||
this.$refs.multipleTable.toggleRowSelection(el)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
filterAddressIsDefault() {
|
||||
return this.tableData.filter((item) => item.isDefault === true)
|
||||
},
|
||||
async checkSelectionChange(selection, row) {
|
||||
row.isChecked = selection.includes(row)
|
||||
const resp = await this.$axios.post("/platform/benefit/shop/editCart", row)
|
||||
},
|
||||
handleSelectionChange(selection) {
|
||||
this.cartSelectList = selection
|
||||
this.totalPrice = 0
|
||||
for (var i = 0; i < selection.length; i++) {
|
||||
this.totalPrice += selection[i].benefitGoodsSpecifications.points
|
||||
}
|
||||
},
|
||||
allSelectionChange(selection) {
|
||||
let productIdAllList = []
|
||||
|
||||
this.cartList.forEach((item) => {
|
||||
productIdAllList.push(item.id.toString())
|
||||
})
|
||||
|
||||
this.$axios.post("/platform/benefit/shop/editCartList", {
|
||||
ids: JSON.stringify(productIdAllList),
|
||||
isChecked: selection.length > 0 ? 1 : 0
|
||||
})
|
||||
},
|
||||
calculateTotalPrice() {
|
||||
return this.formData.reduce((sum, item) => sum + item.points, 0)
|
||||
},
|
||||
cartDelete(id) {
|
||||
this.$confirm("是否删除此商品", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(async () => {
|
||||
const resp = await this.$axios.post("/platform/benefit/shop/deleteCart", { id: id })
|
||||
if (resp.code === 0) {
|
||||
this.getCart()
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: resp.msg
|
||||
})
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
submitCart() {
|
||||
const data = []
|
||||
for (let i = 0; i < this.cartSelectList.length; i++) {
|
||||
let cart = this.cartSelectList[i]
|
||||
data.push({
|
||||
goodsName: cart.benefitGoods.name,
|
||||
simpleDesc: cart.benefitGoods.simpleDesc,
|
||||
imgUrl: cart.benefitGoods.imgUrl,
|
||||
...cart.benefitGoodsSpecifications,
|
||||
cartId: cart.id
|
||||
})
|
||||
}
|
||||
this.onOpen(data, 2)
|
||||
}
|
||||
},
|
||||
style: /*language=CSS*/ `
|
||||
.ellipsis {
|
||||
white-space: nowrap; /* 不换行 */
|
||||
overflow: hidden; /* 隐藏超出的内容 */
|
||||
text-overflow: ellipsis; /* 用省略号表示被隐藏的部分 */
|
||||
max-width: 200px; /* 设置最大宽度以限制文本的显示长度 */
|
||||
}
|
||||
.price-show {
|
||||
font-weight: bold;
|
||||
font-size: 27px;
|
||||
color: #E1140A;
|
||||
}
|
||||
.cart-price{
|
||||
font-size: 16px;
|
||||
color: #e2231a;
|
||||
font-family: verdana;
|
||||
font-weight: 700;
|
||||
}
|
||||
.desc{
|
||||
color: #A2A2A2;
|
||||
font-size: 14px;
|
||||
margin-top: 8px;
|
||||
line-height: 22px;
|
||||
word-break: break-all;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.shopCart {
|
||||
.table {
|
||||
position: relative;
|
||||
.el-input__inner {
|
||||
text-align: center;
|
||||
}
|
||||
.el-input-group__append {
|
||||
padding: 0 15px;
|
||||
}
|
||||
.el-input-group__prepend {
|
||||
padding: 0 15px;
|
||||
}
|
||||
.shopImg {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
}
|
||||
.price,
|
||||
.shop {
|
||||
color: #000733;
|
||||
}
|
||||
.count {
|
||||
color: #bfa548;
|
||||
}
|
||||
.el-checkbox__inner {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.el-checkbox__inner::after {
|
||||
left: 7px;
|
||||
top: 3px;
|
||||
}
|
||||
.el-checkbox__input.is-indeterminate .el-checkbox__inner::before {
|
||||
top: 7px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.shopCart .table {
|
||||
margin-top: 50px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.shopCart .table .el-input__inner {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.shopCart .table .el-input-group__append {
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
.shopCart .table .el-input-group__prepend {
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
.shopCart .table .shopImg {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.shopCart .table .price,
|
||||
.shopCart .table .shop {
|
||||
color: #000733;
|
||||
}
|
||||
|
||||
.shopCart .table .count {
|
||||
color: #e2231a;
|
||||
}
|
||||
|
||||
.shopCart .table .el-checkbox__inner {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.shopCart .tab le .el-checkbox__inner::after {
|
||||
left: 7px;
|
||||
top: 3px;
|
||||
}
|
||||
|
||||
.shopCart .table .el-checkbox__input.is-indeterminate .el-checkbox__inner::before {
|
||||
top: 7px;
|
||||
}
|
||||
|
||||
.el-empty__image {
|
||||
width: 500px;
|
||||
}
|
||||
`
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
const elevator = {
|
||||
template: /*language=HTML*/ `
|
||||
<div class="elevator">
|
||||
<ul class="elevator_list">
|
||||
<li class="elevator_item" @click="shopCar">
|
||||
<img
|
||||
src="https://m.360buyimg.com/babel/jfs/t1/252521/5/15299/714/678e5d4dFc7166e85/96370b055a4906d2.png"
|
||||
class="elevator_lk_img">
|
||||
<img
|
||||
src="https://m.360buyimg.com/babel/jfs/t1/255662/4/13828/673/678f4166F9f84bf55/18785692eb86ecfb.png"
|
||||
class="elevator_lk_hover_img">
|
||||
<span>购物车</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
`,
|
||||
methods: {
|
||||
shopCar() {
|
||||
this.$emit("car")
|
||||
}
|
||||
},
|
||||
style: /*language=CSS*/ `
|
||||
.elevator {
|
||||
position: fixed;
|
||||
bottom: 50%;
|
||||
right: 0;
|
||||
-ms-transform: translateY(50%);
|
||||
transform: translateY(50%);
|
||||
transition: transform .5s;
|
||||
z-index: 100;
|
||||
-webkit-box-shadow: -2px 0 30px 2px rgba(97, 105, 119, .18);
|
||||
box-shadow: -2px 0 30px 2px rgba(97, 105, 119, .18);
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.elevator:hover{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.elevator_list {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.elevator_list .elevator_item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
column-gap: 5px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.elevator_list .elevator_item:hover {
|
||||
background: red;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.elevator_list .elevator_item img{
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
fill: #333;
|
||||
margin: 0 auto 3px;
|
||||
transition: fill .2sease;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.elevator_list .elevator_item .elevator_lk_hover_img{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.elevator_list .elevator_item:hover .elevator_lk_hover_img{
|
||||
display: block;
|
||||
}
|
||||
|
||||
.elevator_list .elevator_item:hover .elevator_lk_img {
|
||||
display: none;
|
||||
}
|
||||
|
||||
`
|
||||
}
|
||||
@@ -0,0 +1,360 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<style>
|
||||
/* 根节点 */
|
||||
.content {
|
||||
position: relative;
|
||||
z-index: 333;
|
||||
}
|
||||
/* END */
|
||||
|
||||
/* 覆盖默认a标签样式 */
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
a:link,
|
||||
a:visited {
|
||||
color: #5e5e5e;
|
||||
}
|
||||
/* END */
|
||||
|
||||
/* 左侧分类菜单 */
|
||||
.menu-content {
|
||||
width: 244px;
|
||||
height: 464px;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
padding-top: 6px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.menu-item {
|
||||
height: 64px;
|
||||
line-height: 66px;
|
||||
padding: 0 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.menu-item:hover {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
/* .2 就是过渡的时间 */
|
||||
transition: all 0.2s linear;
|
||||
}
|
||||
.menu-item span {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #fff;
|
||||
padding: 0 8px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
|
||||
height: 64px;
|
||||
font-size: 16px;
|
||||
}
|
||||
.menu-item:last-child span {
|
||||
border-bottom: none;
|
||||
}
|
||||
.menu-item span span {
|
||||
flex: 1;
|
||||
}
|
||||
.menu-item span .fa {
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
font-size: 18px;
|
||||
}
|
||||
/* 二级分类菜单 */
|
||||
.sub-menu {
|
||||
border: 1px solid #d9dde1;
|
||||
background-color: #fff;
|
||||
width: calc(80vw - 244px);
|
||||
max-width: 430px;
|
||||
height: 458px;
|
||||
position: absolute;
|
||||
left: 244px;
|
||||
top: 0;
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
.inner-box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
.sub-inner-box {
|
||||
width: 100%;
|
||||
margin-left: 40px;
|
||||
width: calc(100% - 40px);
|
||||
}
|
||||
.sub-inner-box .title {
|
||||
color: #00ca78;
|
||||
font-size: 16px;
|
||||
line-height: 16px;
|
||||
font-weight: bold;
|
||||
margin-top: 28px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.sub-inner-box .sub-row {
|
||||
margin-bottom: 25px;
|
||||
line-height: 25px;
|
||||
}
|
||||
.sub-inner-box .sub-row .bold {
|
||||
font-weight: 700;
|
||||
margin-right: 15px;
|
||||
}
|
||||
.sub-inner-box .sub-row a {
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.icon-stle {
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
}
|
||||
|
||||
/*商品列表*/
|
||||
.bottom {
|
||||
margin-top: 10px;
|
||||
line-height: 12px;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.clearfix:before,
|
||||
.clearfix:after {
|
||||
display: table;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.clearfix:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.el-collapse-item__header.is-active {
|
||||
padding: 16px;
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
color: #1f1f1f;
|
||||
letter-spacing: -0.16px;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 18px;
|
||||
color: #242424;
|
||||
font-weight: 600;
|
||||
}
|
||||
.el-card__header {
|
||||
padding: 15px 17px;
|
||||
border-bottom: 0px solid var(--border-color-lighter);
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.pro-cur-price {
|
||||
display: inline-block;
|
||||
margin-right: 11px;
|
||||
}
|
||||
.currency-sign {
|
||||
font-size: 16px;
|
||||
color: #e72d21;
|
||||
font-weight: bold;
|
||||
}
|
||||
.pro-price {
|
||||
font-size: 16px;
|
||||
color: #e2231a;
|
||||
font-weight: 600;
|
||||
}
|
||||
.el-collapse-item__content {
|
||||
padding-bottom: 0px;
|
||||
font-size: 13px;
|
||||
color: var(--color-text-primary);
|
||||
line-height: 1.7692307692;
|
||||
}
|
||||
</style>
|
||||
<div id="app">
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<elevator @car="shopCar"></elevator>
|
||||
|
||||
<div class="content">
|
||||
<!-- 分类菜单 -->
|
||||
<div class="menu-content" @mouseout="hideSubMenu">
|
||||
<div class="menu-item" v-for="(item, index) in goodsCategoryList" :key="index" @mouseover="showSubMenu(index)">
|
||||
<span @click="initProject(item.id)">
|
||||
<span>{{item.name}}</span>
|
||||
<img src="https://s1.ax1x.com/2023/04/20/p9klxA0.png" class="icon-stle" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END -->
|
||||
|
||||
<!-- 二级菜单 -->
|
||||
<div class="sub-menu hide" @mouseover="showSubMenu(-1)" @mouseout="hideSubMenu">
|
||||
<div class="inner-box" v-show="goodsCategoryIndex == index" v-for="(item, index) in goodsCategoryList" :key="index">
|
||||
<div class="sub-inner-box">
|
||||
<div class="title">{{item.name}}</div>
|
||||
<div class="sub-row" v-for="(child, ind) in item.children" :key="ind">
|
||||
<span class="bold">
|
||||
<el-link @click="initProject(child.id)" href="" target="_blank">{{child.name}}</el-link>
|
||||
</span>
|
||||
<el-link href="" target="_blank" v-for="(children2, ind2) in child.children" :key="ind2">{{children2.name}}</el-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END -->
|
||||
</div>
|
||||
<div>
|
||||
<el-carousel height="470px" indicator-position="none">
|
||||
<el-carousel-item v-for="(item,index) in items" type="card" :key="index">
|
||||
<!-- <el-image style="width: 100%; height: 100%" :src="item.image" fit="scale-down"></el-image>-->
|
||||
<div
|
||||
@click="openGoods(item)"
|
||||
:style="'background:url('+item.carouselImgUrl[0].url+') center center no-repeat'"
|
||||
style="width: 100%; height: 100%"
|
||||
></div>
|
||||
</el-carousel-item>
|
||||
</el-carousel>
|
||||
</div>
|
||||
<div>
|
||||
<el-card
|
||||
class="box-card"
|
||||
v-if="category.goodsList.length>0"
|
||||
v-for="(category, index) in categoryList"
|
||||
:key="category"
|
||||
style="width: 100%; margin-top: 10px"
|
||||
>
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="title">{{category.name}}</span>
|
||||
<!--<el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>-->
|
||||
</div>
|
||||
<div class="text item">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6" v-for="(goods, index) in category.goodsList" :key="goods">
|
||||
<div @click="openGoods(goods)">
|
||||
<el-card shadow="hover">
|
||||
<img v-if="goods.imgUrl.length>0" :src="goods.imgUrl[0].url" class="image" />
|
||||
<el-image v-else>
|
||||
<div slot="error" class="image-slot">
|
||||
<i class="el-icon-picture-outline"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<div style="padding-top: 10px">
|
||||
<span class="title">{{goods.name}}</span>
|
||||
<div class="bottom clearfix">
|
||||
<div class="pro-cur-price">
|
||||
<span class="currency-sign">¥</span>
|
||||
<span class="pro-price">{{goods.money}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<template #view>
|
||||
<shop-dialog ref="info" @close_car="closeCar"></shop-dialog>
|
||||
</template>
|
||||
</guava>
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include("shopDialog.js"){}#-->
|
||||
<!--#include("elevator.js"){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
components: {
|
||||
"shop-dialog": SHOP_DIALOG,
|
||||
elevator
|
||||
},
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
// 当前鼠标移入的分类菜单下标
|
||||
goodsCategoryIndex: 0,
|
||||
// 分类菜单数据
|
||||
goodsCategoryList: [],
|
||||
items: [],
|
||||
currentDate: new Date(),
|
||||
activeNames: ["1"],
|
||||
categoryList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 显示对应的二级分类菜单
|
||||
showSubMenu(index) {
|
||||
if (index != -1) {
|
||||
this.goodsCategoryIndex = index
|
||||
}
|
||||
document.querySelector(".sub-menu").classList.remove("hide")
|
||||
},
|
||||
|
||||
// 隐藏二级分类菜单
|
||||
hideSubMenu() {
|
||||
document.querySelector(".sub-menu").classList.add("hide")
|
||||
},
|
||||
//获取商品类型
|
||||
initGoodsCategory() {
|
||||
this.$axios.post("/platform/benefit/shop/getCategoryTree").then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.goodsCategoryList = res.data
|
||||
this.goodsCategoryList.unshift({
|
||||
id: "",
|
||||
name: "全部",
|
||||
parentId: "",
|
||||
sort: 0,
|
||||
status: 0
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//获取福利商品列表
|
||||
initProject(id) {
|
||||
this.$axios.post("/platform/benefit/shop/getGoodsListByType", { id: id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.categoryList = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
//获取轮播图
|
||||
initGoodsImg() {
|
||||
this.$axios.post("/platform/benefit/shop/getGoodsList").then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.items = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
openGoods(goods) {
|
||||
this.$refs.guava.view(() => {
|
||||
this.$refs.info.onOpen(goods)
|
||||
})
|
||||
},
|
||||
shopCar() {
|
||||
this.$refs.guava.view(() => {
|
||||
this.$refs.info.openCart()
|
||||
})
|
||||
},
|
||||
closeCar() {
|
||||
this.$refs.guava.index(() => {})
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.initGoodsCategory()
|
||||
this.initProject(null)
|
||||
this.initGoodsImg()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,199 @@
|
||||
<!--#include("buyInfo.js"){}#-->
|
||||
const SHOP_DIALOG = {
|
||||
/*language=HTML*/
|
||||
template: `
|
||||
<guava ref="guava">
|
||||
<div style="margin: 0 auto;width: 80%;">
|
||||
<el-breadcrumb style="height: 30px" separator-class="el-icon-arrow-right">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>{{formData.goodsCategoryOneLevelName}}</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>{{formData.goodsCategoryTwoLevelName}}</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<el-container style="padding-bottom: 15px">
|
||||
<el-aside width="500px">
|
||||
<el-carousel height="400px" :interval="5000" indicator-position="none">
|
||||
<el-carousel-item v-for="(item,index) in formData.imgUrl" :key="index">
|
||||
<el-image
|
||||
style="height: 400px;width: 500px"
|
||||
:src="item.url"
|
||||
fit="cover"></el-image>
|
||||
</el-carousel-item>
|
||||
</el-carousel>
|
||||
</el-aside>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<h1 :title="formData.name" class="title">{{formData.name}}</h1>
|
||||
<div class="desc">{{formData.simpleDesc}}</div>
|
||||
</el-header>
|
||||
<el-main>
|
||||
<el-form :model="form" ref="formRef" label-position="left" label-width="50px">
|
||||
<el-form-item label="价格">
|
||||
<span class="price-show">{{formData.money}}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格" v-if="formData.benefitGoodsSpecificationsList">
|
||||
|
||||
<div class="specs">
|
||||
<el-tooltip
|
||||
v-for="specifications in formData.benefitGoodsSpecificationsList"
|
||||
class="item"
|
||||
effect="dark"
|
||||
:content="specifications.name"
|
||||
placement="top">
|
||||
<el-button type="danger" :plain="specificationsId==specifications.id?false:true" @click="getPoints(specifications)">
|
||||
{{ specifications.name }}
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="danger" @click="addCart">加入购物车</el-button>
|
||||
<el-button type="warning" @click="buy">立即购买</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
<el-divider></el-divider>
|
||||
<el-container>
|
||||
<el-main style="padding: 0px">
|
||||
<el-tabs v-model="activeName">
|
||||
<el-tab-pane label="商品详情" name="first">
|
||||
<div v-html="formData.description">
|
||||
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</div>
|
||||
<buy-info ref="buyInfo" @close_cart="closeCart"></buy-info>
|
||||
|
||||
</guava>
|
||||
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
formData: {},
|
||||
radio3: "",
|
||||
form: {},
|
||||
specificationsId: "",
|
||||
activeName: "first",
|
||||
specifications:{}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
"buy-info": BUY_INFO
|
||||
},
|
||||
methods: {
|
||||
onOpen(goods) {
|
||||
this.index = 0
|
||||
this.detail(goods.id)
|
||||
},
|
||||
openCart() {
|
||||
this.$refs.buyInfo.onOpen({},1)
|
||||
},
|
||||
closeCart() {
|
||||
this.$refs.guava.index(() => {})
|
||||
this.$emit("close_car")
|
||||
},
|
||||
detail(id) {
|
||||
this.$axios.post("/platform/benefit/shop/findOne", { id: id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.formData = res.data
|
||||
this.formData.imgUrl = JSON.parse(this.formData.imgUrl)
|
||||
}
|
||||
})
|
||||
},
|
||||
getPoints(specifications) {
|
||||
this.specificationsId = specifications.id
|
||||
this.formData.money = specifications.points
|
||||
this.specifications=specifications
|
||||
this.formData.imgUrl=specifications.imgUrl
|
||||
},
|
||||
buy() {
|
||||
if (this.specificationsId === "") {
|
||||
this.$message.error("请选择商品规格")
|
||||
return
|
||||
}
|
||||
const data = [{
|
||||
goodsName: this.formData.name,
|
||||
simpleDesc: this.formData.simpleDesc,
|
||||
imgUrl: this.formData.imgUrl,
|
||||
...this.specifications
|
||||
}]
|
||||
this.$refs.buyInfo.onOpen(data,2)
|
||||
|
||||
},
|
||||
addCart(){
|
||||
if (this.specificationsId === "") {
|
||||
this.$message.error("请选择商品规格")
|
||||
return
|
||||
}
|
||||
const cart={
|
||||
goodsId:this.formData.id,
|
||||
specificationsId:this.specificationsId
|
||||
}
|
||||
this.$axios.post("/platform/benefit/shop/addCart",
|
||||
cart).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success("加入购物车成功!")
|
||||
this.$refs.buyInfo.onOpen({},1)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
style: /*language=CSS*/ `
|
||||
.title {
|
||||
font-size: 22px;
|
||||
font-weight: normal;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.desc {
|
||||
color: #A2A2A2;
|
||||
font-size: 14px;
|
||||
margin-top: 8px;
|
||||
line-height: 22px;
|
||||
word-break: break-all;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.price-show {
|
||||
font-weight: bold;
|
||||
font-size: 27px;
|
||||
color: #E1140A;
|
||||
}
|
||||
|
||||
.animated-card {
|
||||
animation-name: cardAnimation;
|
||||
animation-duration: 0.5s;
|
||||
animation-fill-mode: both;
|
||||
margin-top: 0 !important;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.specs {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
column-gap: 20px;
|
||||
row-gap: 20px;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.specs button.item {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="所属年份">
|
||||
<el-date-picker
|
||||
:clearable="false"
|
||||
@change="getWelfareList"
|
||||
placeholder="所属年份"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy"
|
||||
></el-date-picker>
|
||||
</search-item>
|
||||
|
||||
<search-item label="福利项目">
|
||||
<el-select
|
||||
:clearable="false"
|
||||
@change="doSearch"
|
||||
filterable
|
||||
placeholder="请选择福利项目"
|
||||
style="width: 100%"
|
||||
v-model="pageForm.benefitId"
|
||||
>
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in projectSelectOptions"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="所属工会" v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN','SCHOOL_UNION_WELFARE_ADMIN'])">
|
||||
<el-select clearable filterable placeholder="所属工会" style="width: 100%" v-model="pageForm.unionId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in unions"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never">
|
||||
<table-tool label="福利统计">
|
||||
<el-button
|
||||
@click="openExportSummary"
|
||||
icon="el-icon-download"
|
||||
size="small"
|
||||
type="primary"
|
||||
v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN','SCHOOL_UNION_WELFARE_ADMIN'])"
|
||||
>
|
||||
导出汇总表
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="openSelectByAdmin"
|
||||
icon="el-icon-download"
|
||||
size="small"
|
||||
type="primary"
|
||||
v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN','SCHOOL_UNION_WELFARE_ADMIN'])"
|
||||
>
|
||||
管理员代选择
|
||||
</el-button>
|
||||
</table-tool>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:size="tableSize"
|
||||
@sort-change="pageOrder"
|
||||
class="vi-table"
|
||||
lazy
|
||||
ref="table"
|
||||
row-key="id"
|
||||
show-summary
|
||||
style="width: 100%"
|
||||
v-if="tableData&&tableData.length>0"
|
||||
>
|
||||
<el-table-column type="index" width="50"></el-table-column>
|
||||
<el-table-column
|
||||
:key="column.prop"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template v-if="column.isHasChildren">
|
||||
<el-table-column
|
||||
:key="column2.id"
|
||||
:label="column2.name"
|
||||
:prop="column2.name"
|
||||
v-for="column2 in column.benefitGoodsSpecificationsList"
|
||||
></el-table-column>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
<el-dialog :visible.sync="selectByAdminDialogVisible" title="管理员统一选择福利" width="35%">
|
||||
<el-form label-position="right" label-width="120px">
|
||||
<el-form-item label="福利选项">
|
||||
<el-row :gutter="10" :key="goods.id" style="margin: 10px" v-for="(goods,index) in benefitGoodsList">
|
||||
<el-col :span="16">
|
||||
<el-tag style="height: 40px; line-height: 40px; width: 90%">
|
||||
<div style="white-space: nowrap; display: flex; justify-content: center">
|
||||
<el-tooltip :content="goods.name+' '+goods.money+'积分'" placement="top">
|
||||
<span style="text-overflow: ellipsis; overflow: hidden">{{goods.name}} {{goods.money}}积分</span>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</el-tag>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-input-number :min="0" style="width: 100%" v-model="goods.selectNum"></el-input-number>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="goods.benefitGoodsSpecificationsList&&goods.benefitGoodsSpecificationsList.length>0&&goods.selectNum>0">
|
||||
<el-radio-group size="small" v-model="goods.specificationsId">
|
||||
<el-radio
|
||||
:key="specifications.id"
|
||||
:label="specifications.id"
|
||||
border
|
||||
v-for="specifications in goods.benefitGoodsSpecificationsList"
|
||||
>
|
||||
{{specifications.name}}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-col>
|
||||
<el-col :span="24" style="padding-top: 10px" v-if="goods.goodsProvideMode==='GOODS_PROVIDE_MODE_SHOP'&&goods.selectNum>0">
|
||||
<el-select filterable placeholder="请选择收货门店" style="width: 100%" v-model="goods.shopAddress">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.name" v-for="(item,index) in goods.shopAddressList"></el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-alert class="text-primary mb10">给没有选择的福利人员统一代选择</el-alert>
|
||||
<el-row class="mt10" justify="end" type="flex">
|
||||
<el-button @click="selectByAdminDialogVisible=false">取消</el-button>
|
||||
<el-button @click="doSelectByAdmin" type="primary">提交</el-button>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
<script nonce="${cspNonce!}">
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
projectSelectOptions: [],
|
||||
unions: [],
|
||||
benefitGoodsList: [],
|
||||
selectByAdminDialogVisible: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
viewBenefitGoodsList() {
|
||||
if (this.pageForm.benefitId) {
|
||||
const benefitInfo = this.projectSelectOptions.find((v) => v.id === this.pageForm.benefitId)
|
||||
if (benefitInfo) {
|
||||
return benefitInfo.benefitGoodsList
|
||||
}
|
||||
return null
|
||||
}
|
||||
return null
|
||||
},
|
||||
benefitInfo() {
|
||||
if (this.pageForm.benefitId) {
|
||||
const benefitInfo = this.projectSelectOptions.find((v) => v.id === this.pageForm.benefitId)
|
||||
if (benefitInfo) {
|
||||
return benefitInfo
|
||||
}
|
||||
return null
|
||||
}
|
||||
return null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openSelectByAdmin() {
|
||||
this.benefitGoodsList = clone(this.viewBenefitGoodsList)
|
||||
this.selectByAdminDialogVisible = true
|
||||
},
|
||||
doSelectByAdmin() {
|
||||
let totalMoney = 0
|
||||
const benefitGoodsList = this.benefitGoodsList.filter((b) => b.selectNum > 0)
|
||||
benefitGoodsList.map((b) => {
|
||||
totalMoney = totalMoney + b.selectNum * b.money
|
||||
})
|
||||
if (totalMoney === 0) {
|
||||
this.$message.warning("请选择后再提交!")
|
||||
return
|
||||
}
|
||||
|
||||
if (totalMoney !== this.benefitInfo.totalMoney) {
|
||||
this.$message.warning("本次福利积分【" + this.benefitInfo.totalMoney + "】请检查商品数量!")
|
||||
return
|
||||
}
|
||||
let flag = false
|
||||
let msg = ""
|
||||
benefitGoodsList.some((b) => {
|
||||
if (b.benefitGoodsSpecificationsList && b.benefitGoodsSpecificationsList.length > 0 && !b.specificationsId) {
|
||||
flag = true
|
||||
msg = "商品中存在未填写的规格,请检查!"
|
||||
return true
|
||||
}
|
||||
if (b.shopAddressList && b.shopAddressList.length > 0 && !b.shopAddress) {
|
||||
flag = true
|
||||
msg = "商品中存在未填写的门店地址,请检查!"
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
if (flag) {
|
||||
this.$message.warning(msg)
|
||||
return
|
||||
}
|
||||
|
||||
this.$confirm("请确定是否给未选择的教职工一键选择当前福利?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(async () => {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: "Loading",
|
||||
spinner: "el-icon-loading",
|
||||
background: "rgba(0, 0, 0, 0.7)"
|
||||
})
|
||||
const resp = await this.$axios.post("/platform/benefit/statistics/doSetAllBenefit", {
|
||||
benefitId: this.pageForm.benefitId,
|
||||
benefitGoodsList: JSON.stringify(benefitGoodsList)
|
||||
})
|
||||
loading.close()
|
||||
if (resp.code === 0) {
|
||||
await this.pageData()
|
||||
this.selectByAdminDialogVisible = false
|
||||
this.$message.success(resp.msg)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
openExportSummary() {
|
||||
if (!this.pageForm.benefitId) {
|
||||
this.$message.warning("请选择要导出的福利")
|
||||
return
|
||||
}
|
||||
this.$downLoad("/platform/benefit/statistics/openExportSummary", this.pageForm)
|
||||
},
|
||||
getWelfareList() {
|
||||
this.$set(this.pageForm, "benefitId", "")
|
||||
this.$axios.post("/platform/benefit/statistics/getBenefitList", { year: this.pageForm.year }).then((res) => {
|
||||
this.projectSelectOptions = res.data
|
||||
if (res.data && res.data.length > 0) {
|
||||
this.$set(this.pageForm, "benefitId", res.data[0].id)
|
||||
}
|
||||
this.pageData()
|
||||
})
|
||||
},
|
||||
async pageData() {
|
||||
this.tableLoading = true
|
||||
const resp = await this.$axios.post("/platform/benefit/statistics/pageData", this.pageForm)
|
||||
if (resp.code === 0) {
|
||||
this.tableColumns = [
|
||||
{
|
||||
prop: "name",
|
||||
label: "所属工会",
|
||||
width: "300"
|
||||
}
|
||||
].concat(resp.data.tableColumn)
|
||||
this.tableData = resp.data.tableList
|
||||
}
|
||||
this.tableLoading = false
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.getWelfareList()
|
||||
this.unions = await this.$businessTool.listUnion()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,95 @@
|
||||
let ADD_BENEFIT_USER_BY_SELECT = {
|
||||
template: `
|
||||
<div >
|
||||
<el-drawer :visible.sync="benefitUserDrawer" direction="rtl" size="70%" title="">
|
||||
<div style="margin: 10px">
|
||||
<el-timeline>
|
||||
<el-timeline-item placement="top" timestamp="">
|
||||
<el-input @keyup.enter.native="doSearch" clearable placeholder="请输入内容"
|
||||
style="width: 300px" v-model="pageForm.searchKeyword">
|
||||
<el-select slot="prepend" style="width: 80px;" v-model="pageForm.searchName">
|
||||
<el-option label="姓名" value="username"></el-option>
|
||||
<el-option label="工号" value="loginname"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
<el-button @click="doSearch" icon="el-icon-search" type="primary"></el-button>
|
||||
</el-timeline-item>
|
||||
|
||||
<el-timeline-item placement="top" timestamp="">
|
||||
<el-table :data="tableData" :size="tableSize"
|
||||
@sort-change="pageOrder" class="vi-table"
|
||||
ref="table" row-key="id" style="width: 100%"
|
||||
v-loading="tableLoading" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" :reserve-selection="true"></el-table-column>
|
||||
<el-table-column :index="indexMethod" align="center" header-align="center"
|
||||
label="序号" type="index"
|
||||
width="80px"></el-table-column>
|
||||
<el-table-column label="工号" prop="loginname" sortable width="150px"></el-table-column>
|
||||
<el-table-column label="姓名" prop="username" sortable width="150px"></el-table-column>
|
||||
<el-table-column label="在职状态" prop="userState" sortable width="150px"></el-table-column>
|
||||
<el-table-column label="编制类别" prop="personType" sortable width="150px"></el-table-column>
|
||||
<el-table-column label="所在单位" prop="unitName" show-overflow-tooltip
|
||||
sortable></el-table-column>
|
||||
<el-table-column label="所在工会" prop="unionName" sortable></el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
<div style="display: flex;justify-content: flex-end">
|
||||
<el-button type="primary" @click="benefitUserDrawer=false">关闭</el-button>
|
||||
<el-button type="primary" @click="doBenefitUser">提交</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
`,
|
||||
store,
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
pageForm: {
|
||||
searchName: "username"
|
||||
},
|
||||
selectUserIds: [],
|
||||
benefitUserDrawer: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSelectionChange(val) {
|
||||
this.selectUserIds = val.map(v => v.id)
|
||||
},
|
||||
pageData() {
|
||||
this.$axios.post("/platform/benefit/user/selectNotBenefitUser", this.pageForm).then((res) => {
|
||||
this.tableLoading = false
|
||||
this.tableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
})
|
||||
},
|
||||
selectNotWelfareList(benefitId) {
|
||||
this.pageForm.benefitId = benefitId
|
||||
this.pageForm.searchKeyword = ""
|
||||
this.pageData()
|
||||
},
|
||||
async doBenefitUser() {
|
||||
const confirm = await this.$confirm("确定要将当前选择的人加入到当前福利名单中吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
if (confirm === "confirm") {
|
||||
this.$axios.post("/platform/benefit/user/doBenefitUser", {
|
||||
ids: JSON.stringify(this.selectUserIds),
|
||||
benefitId: this.pageForm.benefitId
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.pageData()
|
||||
this.$emit("search")
|
||||
this.$refs.table.clearSelection()
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="所属年份">
|
||||
<el-date-picker
|
||||
:clearable="false"
|
||||
@change="getWelfareList"
|
||||
placeholder="所属年份"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy"
|
||||
></el-date-picker>
|
||||
</search-item>
|
||||
|
||||
<search-item label="福利项目">
|
||||
<el-select :clearable="false" filterable placeholder="请选择福利项目" style="width: 100%" v-model="pageForm.benefitId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in projectSelectOptions"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
|
||||
<search-item label="职工信息">
|
||||
<el-input
|
||||
@keyup.enter.native="doSearch"
|
||||
clearable
|
||||
placeholder="请输入内容"
|
||||
style="width: 100%"
|
||||
v-model="pageForm.searchKeyword"
|
||||
>
|
||||
<el-select slot="prepend" style="width: 80px" v-model="pageForm.searchName">
|
||||
<el-option label="姓名" value="us.username"></el-option>
|
||||
<el-option label="工号" value="us.loginname"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
</search-item>
|
||||
|
||||
<search-item label="所属工会">
|
||||
<el-select clearable filterable placeholder="请选择所属工会" style="width: 100%" v-model="pageForm.unionId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in unionList"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
|
||||
<search-item label="所属单位">
|
||||
<el-select clearable filterable multiple placeholder="请选择所属单位" style="width: 100%" v-model="pageForm.unitIds">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in unitList"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
|
||||
<search-item label="人员类型:">
|
||||
<dict-select clearable code="USER_PERSON_TYPE" multiple placeholder="请选择人员类型" v-model="pageForm.personTypes"></dict-select>
|
||||
</search-item>
|
||||
<search-item label="在职状态:">
|
||||
<dict-select clearable code="USER_STATE" multiple placeholder="请选择人员状态" v-model="pageForm.userStates"></dict-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never">
|
||||
<table-tool label="福利名单">
|
||||
<el-button @click="openExport" icon="el-icon-download" size="small" type="primary">导出</el-button>
|
||||
<el-button @click="openImport" icon="el-icon-plus" size="small" type="primary">导入</el-button>
|
||||
<el-button @click="openSelectUser" icon="el-icon-plus" size="small" type="primary">选择加入</el-button>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" @sort-change="pageOrder" ref="table" row-key="id" v-loading="tableLoading">
|
||||
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
:key="column.prop"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
min-width="100px"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
></el-table-column>
|
||||
<el-table-column label="操作" width="100px">
|
||||
<template slot-scope="{row}">
|
||||
<el-button @click="doDelete(row)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
<el-dialog :close-on-click-modal="false" :visible.sync="importDialog" title="福利名单导入" width="50%">
|
||||
<file-import
|
||||
:business_id="pageForm.benefitId"
|
||||
@flush="successImport"
|
||||
is_show_radio
|
||||
post_url="/platform/benefit/user/doImportBenefitUser"
|
||||
ref="importBenefitUser"
|
||||
temp_url="/platform/benefit/user/downloadImport"
|
||||
></file-import>
|
||||
</el-dialog>
|
||||
|
||||
<add_benefit_user_by_select @search="doSearch" ref="addBenefitUser"></add_benefit_user_by_select>
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include("addBenefitUserBySelect.js"){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
projectSelectOptions: [],
|
||||
importDialog: false,
|
||||
importLoading: false,
|
||||
pageForm: {
|
||||
searchName: "us.username",
|
||||
year: moment().format("YYYY")
|
||||
},
|
||||
unitList: [],
|
||||
unionList: [],
|
||||
tableColumns: [
|
||||
{ prop: "loginName", label: "工号" },
|
||||
{ prop: "userName", label: "姓名" },
|
||||
{ prop: "sex", label: "性别", sortable: true },
|
||||
{ prop: "mobile", label: "联系方式" },
|
||||
{ prop: "personType", label: "人员类型", sortable: true },
|
||||
{ prop: "userState", label: "在职状态", sortable: true },
|
||||
{ prop: "unionName", label: "所属工会", sortable: true },
|
||||
{ prop: "unitName", label: "所属单位", sortable: true }
|
||||
]
|
||||
}
|
||||
},
|
||||
components: {
|
||||
add_benefit_user_by_select: ADD_BENEFIT_USER_BY_SELECT,
|
||||
"file-import": httpVueLoader("/components/plugins/sysImport/index.vue?v=" + new Date().getTime())
|
||||
},
|
||||
methods: {
|
||||
//导出
|
||||
openExport() {
|
||||
if (!this.pageForm.benefitId) {
|
||||
this.$message.warning("请选择要导出的福利")
|
||||
return
|
||||
}
|
||||
this.$downLoad("/platform/benefit/user/exportBenefitUser", this.pageForm)
|
||||
},
|
||||
openImport() {
|
||||
this.importDialog = true
|
||||
this.$refs.importBenefitUser.importData = {
|
||||
fileList: [],
|
||||
isFlag: false
|
||||
}
|
||||
this.$refs.importBenefitUser.errorInfoData = {
|
||||
totalCount: 0,
|
||||
successCount: 0,
|
||||
errorCount: 0,
|
||||
errorList: 0
|
||||
}
|
||||
},
|
||||
successImport() {
|
||||
this.pageData()
|
||||
this.importDialog = false
|
||||
},
|
||||
openSelectUser() {
|
||||
this.$refs.addBenefitUser.benefitUserDrawer = true
|
||||
this.$refs.addBenefitUser.selectNotWelfareList(this.pageForm.benefitId)
|
||||
},
|
||||
getWelfareList() {
|
||||
this.$set(this.pageForm, "benefitId", "")
|
||||
this.$axios.post("/platform/benefit/project/getBenefitList", { year: this.pageForm.year }).then((res) => {
|
||||
this.projectSelectOptions = res.data
|
||||
if (res.data && res.data.length > 0) {
|
||||
this.$set(this.pageForm, "benefitId", res.data[0].id)
|
||||
}
|
||||
this.pageData()
|
||||
})
|
||||
},
|
||||
doDelete(row) {
|
||||
this.$confirm("确定要删除【" + row.userName + "】?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios
|
||||
.post("/platform/benefit/user/deleteBenefitUser", {
|
||||
id: row.id,
|
||||
benefitId: row.benefitId
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
pageData() {
|
||||
this.tableLoading = true
|
||||
const pageForm = clone(this.pageForm)
|
||||
pageForm.unitIds = JSON.stringify(pageForm.unitIds)
|
||||
pageForm.personTypes = JSON.stringify(pageForm.personTypes)
|
||||
pageForm.userStates = JSON.stringify(pageForm.userStates)
|
||||
this.$axios.post(loc() + "/pageData", pageForm).then((res) => {
|
||||
this.tableLoading = false
|
||||
this.tableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
})
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.getWelfareList()
|
||||
this.unionList = await this.$businessTool.listUnion()
|
||||
this.unitList = await this.$businessTool.listUnit()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="所属年份">
|
||||
<el-date-picker
|
||||
:clearable="false"
|
||||
placeholder="所属年份"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy"
|
||||
></el-date-picker>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never">
|
||||
<table-tool label="福利名单"></table-tool>
|
||||
<el-table :data="tableData" @sort-change="pageOrder" ref="table" row-key="id" v-loading="tableLoading">
|
||||
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
|
||||
<el-table-column
|
||||
:key="column.prop"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
min-width="100px"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template v-if="column.prop==='provideMode'" v-slot="{row}">
|
||||
<dict-tag :options="dict.type.BENEFIT_PROVIDE_MODE" :value="row.provideMode"></dict-tag>
|
||||
</template>
|
||||
<template v-else-if="column.prop==='signMode'" v-slot="{row}">
|
||||
<dict-tag :options="dict.type.BENEFIT_SIGN_MODE" :value="row.signMode"></dict-tag>
|
||||
</template>
|
||||
<template v-else-if="column.prop==='isChoice'" v-slot="{row}">{{row.isChoice?'已选择':'未选择'}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120px">
|
||||
<template slot-scope="{row}">
|
||||
<el-button @click="openSelectionBenefit(row)" size="mini" type="primary">选择福利</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
</guava>
|
||||
<selection-benefit @query="pageData" ref="selectionBenefitRef"></selection-benefit>
|
||||
</div>
|
||||
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include("selectionBefit.js"){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
dicts: ["BENEFIT_FESTIVAL", "BENEFIT_SIGN_MODE", "BENEFIT_PROVIDE_MODE", "BENEFIT_GOODS_PROVIDE_MODE"],
|
||||
data() {
|
||||
return {
|
||||
pageForm: {
|
||||
year: moment().format("YYYY")
|
||||
},
|
||||
tableColumns: [
|
||||
{ prop: "year", label: "年度" },
|
||||
{ prop: "benefitName", label: "福利名称" },
|
||||
{ prop: "startChoiceTime", label: "选择开始时间" },
|
||||
{ prop: "endChoiceTime", label: "选择结束时间" },
|
||||
{ prop: "signMode", label: "是否电子签字" },
|
||||
{ prop: "provideMode", label: "发放形式" },
|
||||
{ prop: "isChoice", label: "是否选择" }
|
||||
]
|
||||
}
|
||||
},
|
||||
components: {
|
||||
"selection-benefit": SELECTION_BENEFIT
|
||||
},
|
||||
methods: {
|
||||
openSelectionBenefit(row) {
|
||||
if (row.isChoice) {
|
||||
this.$refs.selectionBenefitRef.openEditSelectionBenefit(row)
|
||||
} else {
|
||||
this.$refs.selectionBenefitRef.openSelectionBenefit(row)
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,474 @@
|
||||
<!--#include("../goods/goodsInfo.js"){}#-->
|
||||
<!--#include("../address/addressDialog.js"){}#-->
|
||||
let SELECTION_BENEFIT = {
|
||||
/*language=HTML*/
|
||||
template: `
|
||||
<div>
|
||||
<el-dialog title="选择福利"
|
||||
:visible.sync="visibleDialog" :close-on-click-modal="false" width="70%">
|
||||
|
||||
<el-form label-suffix=":" :model="formData">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<span
|
||||
style="font-weight: bold;font-size: 20px;display: flex;justify-content: center">{{viewData.name}}</span>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="福利节日">
|
||||
<dict-tag :options="dict.type.BENEFIT_FESTIVAL"
|
||||
:value="viewData.festival"></dict-tag>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="viewData.provideMode==='BENEFIT_PROVIDE_MODE_ONE'">
|
||||
<el-form-item label="福利礼品">
|
||||
{{viewData.giftName}}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否电子签字">
|
||||
<dict-tag :options="dict.type.BENEFIT_SIGN_MODE"
|
||||
:value="viewData.signMode"></dict-tag>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="发放形式">
|
||||
<dict-tag :options="dict.type.BENEFIT_PROVIDE_MODE"
|
||||
:value="viewData.provideMode"></dict-tag>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="viewData.provideMode==='BENEFIT_PROVIDE_MODE_TWO'">
|
||||
<el-form-item label="选择时间">
|
||||
{{$moment(viewData.startChoiceTime).format("YYYY-MM-DD HH:mm")}}
|
||||
至
|
||||
{{$moment(viewData.endChoiceTime).format("YYYY-MM-DD HH:mm")}}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="viewData.provideMode==='BENEFIT_PROVIDE_MODE_TWO'">
|
||||
<el-form-item label="逾期选择时间">
|
||||
<span v-if="viewData.endOverdueChoiceTime">
|
||||
{{
|
||||
$moment(viewData.endOverdueChoiceTime).format("YYYY-MM-DD HH:mm")
|
||||
}}
|
||||
</span>
|
||||
<span v-else>暂无</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="viewData.provideMode==='BENEFIT_PROVIDE_MODE_TWO'">
|
||||
<el-form-item label="福利总积分">
|
||||
{{viewData.totalMoney}}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10" v-if="viewData.provideMode==='BENEFIT_PROVIDE_MODE_TWO'">
|
||||
<el-form-item label="福利套餐"></el-form-item>
|
||||
<el-col :span="6" v-for="(item,index) in viewData.benefitGoodsList"
|
||||
:key="item.id" style="padding-bottom: 10px">
|
||||
<el-card :body-style="{ padding: '10px' }">
|
||||
<el-tooltip content="点击查看商品详情" placement="top">
|
||||
<el-image
|
||||
style="width: 100%;height: 300px"
|
||||
v-if="item.imgUrl&&item.imgUrl.length>0"
|
||||
:src="item.imgUrl[0].url"
|
||||
fit="contain" @click="openGoods(item.id)"></el-image>
|
||||
<el-image
|
||||
style="width: 100%;height: 300px"
|
||||
v-else
|
||||
src="/assets/mobile/img/benefit/1.png"
|
||||
fit="contain" @click="openGoods(item.id)"></el-image>
|
||||
</el-tooltip>
|
||||
<div style="padding: 14px;">
|
||||
<div
|
||||
style="white-space: nowrap;display: flex;padding: 5px">
|
||||
<el-tooltip :content="item.simpleDesc" placement="top">
|
||||
<span
|
||||
style="text-overflow: ellipsis;overflow: hidden;font-weight: bold;font-size: 15px">
|
||||
{{item.name}}
|
||||
</span>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div style="padding: 5px">
|
||||
<span
|
||||
style="color: red;font-weight: bold;font-size: 20px">¥{{item.money}}</span>
|
||||
</div>
|
||||
<div style="padding: 5px">
|
||||
<el-input-number :min="0" style="width: 100%"
|
||||
v-model="item.selectNum"></el-input-number>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-card v-if="viewData.provideMode==='BENEFIT_PROVIDE_MODE_ONE'
|
||||
&&viewData.signMode==='BENEFIT_SIGN_MODE_ONE'">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<pc-signature v-model="formData.userSign"></pc-signature>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visibleDialog = false">取 消</el-button>
|
||||
<el-button type="primary" @click="openSubmit">提 交</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="提交商品确认"
|
||||
:visible.sync="submitVisibleDialog" :close-on-click-modal="false"
|
||||
width="50%">
|
||||
<el-form label-suffix=":" :model="formData">
|
||||
<el-card v-for="(goods,index) in formData.benefitGoodsList"
|
||||
:key="goods.id">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
{{goods.name}}
|
||||
<span style="display: flex;justify-content: flex-end;color:red;">
|
||||
x{{goods.selectNum}}
|
||||
</span>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<el-radio-group v-model="goods.specificationsId" size="small"
|
||||
@change="specificationsChange(goods.specificationsId,index)">
|
||||
<el-radio :label="specifications.id" border
|
||||
:key="specifications.id"
|
||||
v-for="specifications in goods.benefitGoodsSpecificationsList">
|
||||
{{specifications.name}}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24"
|
||||
v-if="goods.goodsProvideMode==='GOODS_PROVIDE_MODE_POST'"
|
||||
style="padding-top: 10px">
|
||||
<div v-if="!goods.receiveAddress">
|
||||
<div style="display: flex; column-gap: 10px;">
|
||||
<div style="flex: 1">
|
||||
<el-select @change="addressChange(goods)"
|
||||
filterable placeholder="请选择收货地址"
|
||||
style="width: 100%"
|
||||
v-model="goods.addressId">
|
||||
<el-option
|
||||
:key="item.id"
|
||||
:label="item.name+' '+item.defaultName"
|
||||
:value="item.id"
|
||||
v-for="item in addressOptions">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<el-button
|
||||
@click="openAddress"
|
||||
type="primary">添加收货地址
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div style="display: flex; column-gap: 10px;">
|
||||
<div style="flex: 1">
|
||||
<el-input :value="goods.receiveAddress"
|
||||
readonly></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<el-button
|
||||
@click="editAddress(index)"
|
||||
type="primary">修改收货地址
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24"
|
||||
v-if="goods.goodsProvideMode==='GOODS_PROVIDE_MODE_SHOP'"
|
||||
style="padding-top: 10px">
|
||||
<el-select filterable placeholder="请选择收货门店"
|
||||
style="width: 100%"
|
||||
v-model="goods.shopAddress">
|
||||
<el-option
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.name"
|
||||
v-for="(item,index) in goods.shopAddressList">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-card>
|
||||
<el-card v-if="viewData.signMode==='BENEFIT_SIGN_MODE_ONE'">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<pc-signature v-model="formData.userSign"></pc-signature>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
||||
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button
|
||||
@click="visibleDialog = true;submitVisibleDialog = false">关闭继续选择</el-button>
|
||||
<el-button type="primary" @click="submit">提 交</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<benefit-goods-info ref="benefitGoodsInfo"></benefit-goods-info>
|
||||
|
||||
<address-dialog ref="addressDialog"
|
||||
@select_user_address="selectUserAddress"></address-dialog>
|
||||
</div>
|
||||
`,
|
||||
store,
|
||||
dicts: ["BENEFIT_FESTIVAL", "BENEFIT_SIGN_MODE", "BENEFIT_PROVIDE_MODE", "BENEFIT_GOODS_PROVIDE_MODE"],
|
||||
data() {
|
||||
return {
|
||||
visibleDialog: false,
|
||||
submitVisibleDialog: false,
|
||||
viewData: {},
|
||||
formData: {},
|
||||
addressOptions: [],
|
||||
userSelection: []
|
||||
}
|
||||
},
|
||||
components: {
|
||||
"benefit-goods-info": BENEFIT_GOODS_INFO,
|
||||
"address-dialog": ADDRESS_DIALOG
|
||||
},
|
||||
methods: {
|
||||
specificationsChange(val, index) {
|
||||
this.$set(this.formData.benefitGoodsList[index], "specificationsId", val)
|
||||
this.$forceUpdate()
|
||||
},
|
||||
editAddress(index) {
|
||||
this.$set(this.formData.benefitGoodsList[index], "addressId", "")
|
||||
this.$set(this.formData.benefitGoodsList[index], "receiveAddress", "")
|
||||
this.$forceUpdate()
|
||||
},
|
||||
submit() {
|
||||
if (this.viewData.signMode === "BENEFIT_SIGN_MODE_ONE" && !this.formData.userSign) {
|
||||
this.$message.warning("请签字后再提交!")
|
||||
return
|
||||
}
|
||||
let flag = false
|
||||
let msg = ""
|
||||
this.formData.benefitGoodsList.some(b => {
|
||||
if (b.goodsProvideMode === "GOODS_PROVIDE_MODE_POST" && !b.receiveAddress) {
|
||||
flag = true
|
||||
msg = "商品中存在未填写的收货地址,请检查!"
|
||||
return true
|
||||
}
|
||||
if (b.benefitGoodsSpecificationsList && b.benefitGoodsSpecificationsList.length > 0 && !b.specificationsId) {
|
||||
flag = true
|
||||
msg = "商品中存在未填写的规格,请检查!"
|
||||
return true
|
||||
}
|
||||
if (b.shopAddressList && b.shopAddressList.length > 0 && !b.shopAddress) {
|
||||
flag = true
|
||||
msg = "商品中存在未填写的门店地址,请检查!"
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
if (flag) {
|
||||
this.$message.warning(msg)
|
||||
return
|
||||
}
|
||||
this.$confirm("确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
const benefitUserSelection = this.formData.benefitGoodsList.map(b => {
|
||||
let data = {
|
||||
"specificationsId": b.specificationsId,
|
||||
"receiveAddress": b.receiveAddress,
|
||||
"shopAddress": b.shopAddress,
|
||||
"selectNum": b.selectNum,
|
||||
"benefitId": this.viewData.id,
|
||||
"goodsId": b.id,
|
||||
"selectUserId": b.selectUserId,
|
||||
"userSign": this.formData.userSign
|
||||
}
|
||||
return data
|
||||
})
|
||||
this.$axios.post("/platform/benefit/userSelection/submit", {
|
||||
benefitUserSelection: JSON.stringify(benefitUserSelection),
|
||||
benefitId: this.viewData.id,
|
||||
userId: this.viewData.userId
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success("提交成功")
|
||||
this.submitVisibleDialog = false
|
||||
this.$emit("query")
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
|
||||
},
|
||||
addressChange(goods) {
|
||||
const address = this.addressOptions.find(a => a.id === goods.addressId)
|
||||
const { province, city, county, name, tel } = address
|
||||
if (goods.postProvideConfig.choiceMunicipality && city !== goods.postProvideConfig.choiceMunicipality) {
|
||||
this.$message.warning("当前福利限制只能邮寄" + goods.postProvideConfig.choiceMunicipality + "!")
|
||||
this.$set(goods, "addressId", "")
|
||||
return
|
||||
}
|
||||
if (goods.postProvideConfig.choiceProvince && province !== goods.postProvideConfig.choiceProvince) {
|
||||
this.$message.warning("当前福利限制只能邮寄" + goods.postProvideConfig.choiceProvince + "!")
|
||||
this.$set(goods, "addressId", "")
|
||||
return
|
||||
}
|
||||
if (address) {
|
||||
this.$set(goods, "receiveAddress", address.name)
|
||||
}
|
||||
},
|
||||
openAddress() {
|
||||
this.$refs.addressDialog.dialogVisible = true
|
||||
this.$refs.addressDialog.formData = {}
|
||||
},
|
||||
/**
|
||||
* isAdmin是否为管理员编辑,管理员就要查询当前传过来的userid,不是管理员就要查询当前登录用户的id
|
||||
* @param isAdmin
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async selectUserAddress(userId) {
|
||||
const resp = await this.$axios.post("/platform/benefit/address/selectUserAddress", { userId })
|
||||
resp.data.map(r => {
|
||||
let defaultName = r.isDefault ? "默认地址" : ""
|
||||
r.defaultName = defaultName
|
||||
r.name = "收货地址:" + r.province + r.city + r.county + r.addressDetail + ",收件人:" + r.userName + ",联系方式:" + r.tel
|
||||
})
|
||||
this.addressOptions = resp.data
|
||||
},
|
||||
provideModeOneDoSubmit() {
|
||||
if (!this.formData.userSign) {
|
||||
this.$message.warning("请签字后再提交!")
|
||||
return
|
||||
}
|
||||
this.$confirm("确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/benefit/userSelection/provideModeOneDoSubmit", {
|
||||
userSign: this.formData.userSign,
|
||||
benefitId: this.viewData.id
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.visibleDialog = false
|
||||
this.$message.success("提交成功")
|
||||
this.$emit("query")
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
openSubmit() {
|
||||
if (this.viewData.provideMode === "BENEFIT_PROVIDE_MODE_ONE"
|
||||
&& this.viewData.signMode === "BENEFIT_SIGN_MODE_ONE") {
|
||||
//如果是统一发放并且需要签字
|
||||
this.provideModeOneDoSubmit()
|
||||
return
|
||||
}
|
||||
let totalMoney = 0
|
||||
const benefitGoodsList = this.viewData.benefitGoodsList.filter(b => b.selectNum > 0)
|
||||
benefitGoodsList.map(b => {
|
||||
totalMoney = totalMoney + b.selectNum * b.money
|
||||
})
|
||||
if (totalMoney === 0) {
|
||||
this.$message.warning("请选择后再提交!")
|
||||
return
|
||||
}
|
||||
if (totalMoney !== this.viewData.totalMoney) {
|
||||
this.$message.warning("本次福利积分【" + this.viewData.totalMoney + "】请检查商品数量!")
|
||||
return
|
||||
}
|
||||
this.formData.benefitGoodsList = benefitGoodsList
|
||||
this.openSubmitView()
|
||||
},
|
||||
openSubmitView() {
|
||||
this.visibleDialog = false
|
||||
setTimeout(() => {
|
||||
this.submitVisibleDialog = true
|
||||
}, 400)
|
||||
},
|
||||
openGoods(id) {
|
||||
this.$refs.benefitGoodsInfo.open(id)
|
||||
},
|
||||
/**
|
||||
* 查询单个福利
|
||||
* @param id
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
async findOneBenefit(id) {
|
||||
const res = await this.$axios.post("/platform/benefit/userSelection/findOneBenefit", { id })
|
||||
if (res.code === 0) {
|
||||
return res.data
|
||||
}
|
||||
},
|
||||
/**
|
||||
*查询用户选择的商品
|
||||
* @param benefitId
|
||||
* @param userId
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async selectSelectionBenefit(benefitId, userId) {
|
||||
const res = await this.$axios.post("/platform/benefit/userSelection/selectSelectionBenefit", {
|
||||
benefitId,
|
||||
userId
|
||||
})
|
||||
if (res.code === 0) {
|
||||
this.userSelection = res.data
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 回显用户选择的数据
|
||||
* @param benefitId
|
||||
* @param userId
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async echoUserSelection(benefitId, userId) {
|
||||
await this.selectSelectionBenefit(benefitId, userId)
|
||||
//获取用户当前选择的数量
|
||||
this.viewData.benefitGoodsList.map(v => {
|
||||
const goods = this.userSelection.find(x => x.goodsId === v.id)
|
||||
if (goods) {
|
||||
v.selectNum = goods.selectNum
|
||||
v.selectUserId = goods.selectUserId
|
||||
v.receiveAddress = goods.receiveAddress
|
||||
v.specificationsId = goods.specificationsId
|
||||
v.shopAddress = goods.shopAddress
|
||||
} else {
|
||||
v.selectNum = 0
|
||||
}
|
||||
})
|
||||
},
|
||||
async openEditSelectionBenefit(row) {
|
||||
//isAdmin是否为管理员编辑,管理员就要查询当前传过来的userid,不是管理员就要查询当前登录用户的id
|
||||
const data = await this.findOneBenefit(row.benefitId)
|
||||
data.userId = row.userId
|
||||
this.viewData = data
|
||||
await this.echoUserSelection(row.benefitId, row.userId)
|
||||
await this.selectUserAddress(row.userId)
|
||||
this.visibleDialog = true
|
||||
},
|
||||
async openSelectionBenefit(row, isAdmin) {
|
||||
|
||||
const data = await this.findOneBenefit(row.benefitId)
|
||||
data.benefitGoodsList.map(v => {
|
||||
v.selectUserId = row.userId
|
||||
v.selectNum = 0
|
||||
v.receiveAddress = ""
|
||||
v.specificationsId = ""
|
||||
})
|
||||
data.userId = row.userId
|
||||
this.viewData = data
|
||||
await this.selectUserAddress(row.userId)
|
||||
this.visibleDialog = true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="所属年份">
|
||||
<el-date-picker
|
||||
:clearable="false"
|
||||
@change="getWelfareList"
|
||||
placeholder="所属年份"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy"
|
||||
></el-date-picker>
|
||||
</search-item>
|
||||
|
||||
<search-item label="福利项目">
|
||||
<el-select
|
||||
:clearable="false"
|
||||
@change="doSearch"
|
||||
filterable
|
||||
placeholder="请选择福利项目"
|
||||
style="width: 100%"
|
||||
v-model="pageForm.benefitId"
|
||||
>
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in projectSelectOptions"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
|
||||
<search-item label="职工信息">
|
||||
<el-input
|
||||
@keyup.enter.native="doSearch"
|
||||
clearable
|
||||
placeholder="请输入内容"
|
||||
style="width: 100%"
|
||||
v-model="pageForm.searchKeyword"
|
||||
>
|
||||
<el-select slot="prepend" style="width: 80px" v-model="pageForm.searchName">
|
||||
<el-option label="姓名" value="bu.username"></el-option>
|
||||
<el-option label="工号" value="bu.loginname"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
</search-item>
|
||||
|
||||
<search-item label="所属工会">
|
||||
<el-select clearable filterable placeholder="请选择所属工会" style="width: 100%" v-model="pageForm.unionId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in unionList"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
|
||||
<search-item label="所属单位">
|
||||
<el-select clearable filterable multiple placeholder="请选择所属单位" style="width: 100%" v-model="pageForm.unitIds">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in unitList"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
|
||||
<search-item label="人员类型:">
|
||||
<dict-select clearable code="USER_PERSON_TYPE" multiple placeholder="请选择人员类型" v-model="pageForm.personTypes"></dict-select>
|
||||
</search-item>
|
||||
<search-item label="在职状态:">
|
||||
<dict-select clearable code="USER_STATE" multiple placeholder="请选择人员状态" v-model="pageForm.userStates"></dict-select>
|
||||
</search-item>
|
||||
<search-item label="福利商品" v-if="pageFormProvideMode==='BENEFIT_PROVIDE_MODE_TWO'">
|
||||
<el-select @change="doSearch" filterable placeholder="请选择福利商品" style="width: 100%" v-model="pageForm.goodsId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in pageFormGoodsList"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never">
|
||||
<table-tool label="福利名单">
|
||||
<el-radio-group @change="doSearch" class="mr10" size="small" v-model="pageForm.isChoice">
|
||||
<el-radio-button label="">全部</el-radio-button>
|
||||
<el-radio-button label="1">已选择</el-radio-button>
|
||||
<el-radio-button label="0">未选择</el-radio-button>
|
||||
</el-radio-group>
|
||||
<el-button @click="openExport" icon="el-icon-download" size="small" type="primary">导出</el-button>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" @sort-change="pageOrder" ref="table" row-key="id" v-loading="tableLoading">
|
||||
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
:key="column.prop"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template v-if="column.prop==='giftName'" v-slot="{row}">
|
||||
<span v-if="row.isChoice">{{row.giftList?row.giftList:row.giftName}}</span>
|
||||
</template>
|
||||
<template v-else-if="column.prop==='isChoice'" v-slot="{row}">
|
||||
<span v-if="row.provideMode==='BENEFIT_PROVIDE_MODE_TWO'">
|
||||
<el-tag effect="dark" v-if="row.isChoice">已选择</el-tag>
|
||||
<el-tag effect="dark" type="info" v-else>未选择</el-tag>
|
||||
</span>
|
||||
<span v-else-if="row.provideMode==='BENEFIT_PROVIDE_MODE_ONE'&&row.signMode==='BENEFIT_SIGN_MODE_ONE'">
|
||||
<el-tag effect="dark" v-if="row.isChoice">已签字</el-tag>
|
||||
<el-tag effect="dark" type="info" v-else>未签字</el-tag>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="收货地址"
|
||||
prop="receiveAddressList"
|
||||
show-overflow-tooltip
|
||||
v-if="pageFormProvideMode==='BENEFIT_PROVIDE_MODE_TWO'"
|
||||
></el-table-column>
|
||||
<el-table-column label="签字" prop="userSign" show-overflow-tooltip v-if="pageFormSignMode==='BENEFIT_SIGN_MODE_ONE'">
|
||||
<template slot-scope="{row}">
|
||||
<el-image :src="row.userSign" fit="cover" style="height: 60px" v-if="row.userSign"></el-image>
|
||||
<el-tag effect="dark" type="info" v-else>暂无</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100px">
|
||||
<template slot-scope="{row}">
|
||||
<el-button
|
||||
:disabled="row.provideMode==='BENEFIT_PROVIDE_MODE_ONE'"
|
||||
@click="openSelectionBenefit(row)"
|
||||
size="mini"
|
||||
type="primary"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
</guava>
|
||||
<selection-benefit @query="pageData" ref="selectionBenefitRef"></selection-benefit>
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include("../userSelection/selectionBefit.js"){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
computed: {
|
||||
pageFormProvideMode() {
|
||||
if (this.pageForm.benefitId) {
|
||||
const projectInfo = this.projectSelectOptions.find((v) => v.id === this.pageForm.benefitId)
|
||||
if (projectInfo) {
|
||||
return projectInfo.provideMode
|
||||
}
|
||||
return null
|
||||
}
|
||||
return null
|
||||
},
|
||||
pageFormSignMode() {
|
||||
if (this.pageForm.benefitId) {
|
||||
const projectInfo = this.projectSelectOptions.find((v) => v.id === this.pageForm.benefitId)
|
||||
if (projectInfo) {
|
||||
return projectInfo.signMode
|
||||
}
|
||||
return null
|
||||
}
|
||||
return null
|
||||
},
|
||||
pageFormGoodsList() {
|
||||
if (this.pageForm.benefitId) {
|
||||
const projectInfo = this.projectSelectOptions.find((v) => v.id === this.pageForm.benefitId)
|
||||
if (projectInfo) {
|
||||
return projectInfo.benefitGoodsList
|
||||
}
|
||||
return null
|
||||
}
|
||||
return null
|
||||
}
|
||||
},
|
||||
components: {
|
||||
"selection-benefit": SELECTION_BENEFIT
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
projectSelectOptions: [],
|
||||
pageForm: {
|
||||
searchName: "bu.username",
|
||||
year: moment().format("YYYY"),
|
||||
isChoice: ""
|
||||
},
|
||||
unitList: [],
|
||||
unionList: [],
|
||||
tableColumns: [
|
||||
{ prop: "loginName", label: "工号" },
|
||||
{ prop: "userName", label: "姓名" },
|
||||
{ prop: "sex", label: "性别", sortable: true },
|
||||
{ prop: "personType", label: "人员类型", sortable: true },
|
||||
{ prop: "userState", label: "在职状态", sortable: true },
|
||||
{ prop: "unionName", label: "所属工会", sortable: true },
|
||||
{ prop: "unitName", label: "所属单位", sortable: true },
|
||||
{ prop: "isChoice", label: "是否选择", sortable: true },
|
||||
{ prop: "giftName", label: "所选福利", sortable: true }
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//导出
|
||||
openExport() {
|
||||
if (!this.pageForm.benefitId) {
|
||||
this.$message.warning("请选择要导出的福利")
|
||||
return
|
||||
}
|
||||
this.$downLoad("/platform/benefit/userSelection/list/exportBenefitUserSelect", this.pageForm)
|
||||
},
|
||||
openSelectionBenefit(row) {
|
||||
const isAdmin = this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN", "SCHOOL_UNION_WELFARE_ADMIN"])
|
||||
if (!isAdmin) {
|
||||
if (row.startChoiceTime > moment().format("YYYY-MM-DD HH:mm") || row.endChoiceTime < moment().format("YYYY-MM-DD HH:mm")) {
|
||||
this.$message.warning("当前时间不在选择范围内!")
|
||||
return
|
||||
}
|
||||
}
|
||||
if (row.isChoice) {
|
||||
this.$refs.selectionBenefitRef.openEditSelectionBenefit(row)
|
||||
} else {
|
||||
this.$refs.selectionBenefitRef.openSelectionBenefit(row)
|
||||
}
|
||||
},
|
||||
getWelfareList() {
|
||||
this.$set(this.pageForm, "benefitId", "")
|
||||
this.$axios.post("/platform/benefit/project/getBenefitList", { year: this.pageForm.year }).then((res) => {
|
||||
this.projectSelectOptions = res.data
|
||||
if (res.data && res.data.length > 0) {
|
||||
this.$set(this.pageForm, "benefitId", res.data[0].id)
|
||||
}
|
||||
this.pageData()
|
||||
})
|
||||
},
|
||||
pageData() {
|
||||
this.tableLoading = true
|
||||
const pageForm = clone(this.pageForm)
|
||||
pageForm.unitIds = JSON.stringify(pageForm.unitIds)
|
||||
pageForm.personTypes = JSON.stringify(pageForm.personTypes)
|
||||
pageForm.userStates = JSON.stringify(pageForm.userStates)
|
||||
this.$axios.post(loc() + "/pageData", pageForm).then((res) => {
|
||||
this.tableLoading = false
|
||||
this.tableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
})
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.getWelfareList()
|
||||
this.unionList = await this.$businessTool.listUnion()
|
||||
this.unitList = await this.$businessTool.listUnit()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="所属年份">
|
||||
<el-date-picker
|
||||
:clearable="false"
|
||||
placeholder="所属年份"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy"
|
||||
></el-date-picker>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never">
|
||||
<table-tool label="我的福利"></table-tool>
|
||||
<el-table :data="tableData" @sort-change="pageOrder" ref="table" row-key="id" v-loading="tableLoading">
|
||||
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
|
||||
<el-table-column
|
||||
:key="column.prop"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
min-width="100px"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template v-if="column.prop==='provideMode'" v-slot="{row}">
|
||||
<dict-tag :options="dict.type.BENEFIT_PROVIDE_MODE" :value="row.provideMode"></dict-tag>
|
||||
</template>
|
||||
<template v-else-if="column.prop==='signMode'" v-slot="{row}">
|
||||
<dict-tag :options="dict.type.BENEFIT_SIGN_MODE" :value="row.signMode"></dict-tag>
|
||||
</template>
|
||||
<template v-else-if="column.prop==='isChoice'" v-slot="{row}">
|
||||
<span v-if="row.provideMode==='BENEFIT_PROVIDE_MODE_TWO'">{{row.isChoice?'已选择':'未选择'}}</span>
|
||||
<span v-else-if="row.provideMode==='BENEFIT_PROVIDE_MODE_ONE'&&row.signMode==='BENEFIT_SIGN_MODE_ONE'">
|
||||
{{row.isChoice?'已签字':'未签字'}}
|
||||
</span>
|
||||
</template>
|
||||
<template v-else-if="column.prop==='giftName'" v-slot="{row}">
|
||||
<span v-if="row.isChoice">{{row.giftList?row.giftList:row.giftName}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120px">
|
||||
<template slot-scope="{row}">
|
||||
<el-button @click="openView(row)" size="mini" type="primary">查看福利</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
<selection-benefit-info ref="selectionBenefitInfoRef"></selection-benefit-info>
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include("info.js"){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
dicts: ["BENEFIT_FESTIVAL", "BENEFIT_SIGN_MODE", "BENEFIT_PROVIDE_MODE", "BENEFIT_GOODS_PROVIDE_MODE"],
|
||||
data() {
|
||||
return {
|
||||
pageForm: {
|
||||
year: moment().format("YYYY")
|
||||
},
|
||||
tableColumns: [
|
||||
{ prop: "year", label: "年度" },
|
||||
{ prop: "benefitName", label: "福利名称" },
|
||||
{ prop: "startChoiceTime", label: "选择开始时间" },
|
||||
{ prop: "endChoiceTime", label: "选择结束时间" },
|
||||
{ prop: "signMode", label: "是否电子签字" },
|
||||
{ prop: "provideMode", label: "发放形式" },
|
||||
{ prop: "giftName", label: "所选礼品" },
|
||||
{ prop: "isChoice", label: "是否选择/签字" }
|
||||
]
|
||||
}
|
||||
},
|
||||
components: {
|
||||
"selection-benefit-info": SELECTION_BENEFIT_INFO
|
||||
},
|
||||
methods: {
|
||||
openView(row) {
|
||||
if (!row.isChoice) {
|
||||
this.$message.warning("当前福利暂未选择,请前往福利选择进行选择!")
|
||||
return
|
||||
}
|
||||
if (row.provideMode === "BENEFIT_PROVIDE_MODE_ONE") {
|
||||
this.$message.warning("当前福利为统一发放【" + row.giftName + "】")
|
||||
return
|
||||
}
|
||||
this.$refs.selectionBenefitInfoRef.open(row.benefitId)
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,154 @@
|
||||
<!--#include("../goods/goodsInfo.js"){}#-->
|
||||
let SELECTION_BENEFIT_INFO = {
|
||||
/*language=HTML*/
|
||||
template: `
|
||||
<div>
|
||||
<el-dialog title="选择福利"
|
||||
:visible.sync="visibleDialog" :close-on-click-modal="false" width="70%">
|
||||
<el-form label-suffix=":">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<span
|
||||
style="font-weight: bold;font-size: 20px;display: flex;justify-content: center">{{viewData.name}}</span>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="福利节日">
|
||||
<dict-tag :options="dict.type.BENEFIT_FESTIVAL"
|
||||
:value="viewData.festival"></dict-tag>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="viewData.provideMode==='BENEFIT_PROVIDE_MODE_ONE'">
|
||||
<el-form-item label="福利礼品">
|
||||
{{viewData.giftName}}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否电子签字">
|
||||
<dict-tag :options="dict.type.BENEFIT_SIGN_MODE"
|
||||
:value="viewData.signMode"></dict-tag>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="发放形式">
|
||||
<dict-tag :options="dict.type.BENEFIT_PROVIDE_MODE"
|
||||
:value="viewData.provideMode"></dict-tag>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="viewData.provideMode==='BENEFIT_PROVIDE_MODE_TWO'">
|
||||
<el-form-item label="选择时间">
|
||||
{{$moment(viewData.startChoiceTime).format("YYYY-MM-DD HH:mm")}}
|
||||
至
|
||||
{{$moment(viewData.endChoiceTime).format("YYYY-MM-DD HH:mm")}}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="viewData.provideMode==='BENEFIT_PROVIDE_MODE_TWO'">
|
||||
<el-form-item label="逾期选择时间">
|
||||
<span v-if="viewData.endOverdueChoiceTime">
|
||||
{{
|
||||
$moment(viewData.endOverdueChoiceTime).format("YYYY-MM-DD HH:mm")
|
||||
}}
|
||||
</span>
|
||||
<span v-else>暂无</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="viewData.provideMode==='BENEFIT_PROVIDE_MODE_TWO'">
|
||||
<el-form-item label="福利总积分">
|
||||
{{viewData.totalMoney}}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<el-card v-for="item in userSelection" :key="item.id">
|
||||
<el-row :gutter="20">
|
||||
<div @click="openGoods(item.goods.id)">
|
||||
<el-col :span="2">
|
||||
<el-image
|
||||
style="width: 100px;height: 100px"
|
||||
:src="item.goods.imgUrl[0].url"
|
||||
fit="contain"
|
||||
v-if="item.goods"></el-image>
|
||||
</el-col>
|
||||
<el-col :span="6" v-if="item.goods">
|
||||
<el-tooltip :content="item.goods.name" placement="top">
|
||||
<div style="cursor: pointer;color: #0a84ff"
|
||||
>
|
||||
{{item.goods.name}}
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</div>
|
||||
<el-col :span="1">
|
||||
x{{item.selectNum}}
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<span
|
||||
v-if="item.shopAddress">收货门店: {{item.shopAddress}}</span>
|
||||
<span>{{item.receiveAddress}}</span>
|
||||
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
{{item.specificationsName}}
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<el-col :span="24">
|
||||
|
||||
</el-col>
|
||||
|
||||
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visibleDialog = false" type="primary">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<benefit-goods-info ref="benefitGoodsInfo"></benefit-goods-info>
|
||||
</div>
|
||||
`,
|
||||
dicts: ["BENEFIT_FESTIVAL", "BENEFIT_SIGN_MODE", "BENEFIT_PROVIDE_MODE", "BENEFIT_GOODS_PROVIDE_MODE"],
|
||||
data() {
|
||||
return {
|
||||
userSelection: [],
|
||||
viewData: {},
|
||||
visibleDialog: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
"benefit-goods-info": BENEFIT_GOODS_INFO
|
||||
},
|
||||
methods: {
|
||||
openGoods(id) {
|
||||
this.$refs.benefitGoodsInfo.open(id)
|
||||
},
|
||||
async findOneBenefit(id) {
|
||||
const res = await this.$axios.post("/platform/benefit/userSelection/findOneBenefit", { id })
|
||||
if (res.code === 0) {
|
||||
this.viewData = res.data
|
||||
}
|
||||
},
|
||||
async selectSelectionBenefit(benefitId) {
|
||||
const res = await this.$axios.post("/platform/benefit/userSelection/selectSelectionBenefit", { benefitId })
|
||||
if (res.code === 0) {
|
||||
this.userSelection = res.data
|
||||
}
|
||||
},
|
||||
async open(id) {
|
||||
await this.selectSelectionBenefit(id)
|
||||
await this.findOneBenefit(id)
|
||||
this.userSelection.map(v => {
|
||||
const data = this.viewData.benefitGoodsList.find(b => b.id === v.goodsId)
|
||||
v.goods = data
|
||||
if (v.specificationsId) {
|
||||
const specifications = data.benefitGoodsSpecificationsList.find(x => x.id === v.specificationsId)
|
||||
v.specificationsName = specifications.name
|
||||
}
|
||||
})
|
||||
this.visibleDialog = true
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user