Commit 9eef2941 by 李伟康

修改众筹活动

1 parent 40bd88e8
<!-- 选择商品 - 单选 --> <!-- 选择商品 - 单选 -->
<template> <template>
<!-- :okText="productList.length ? '确定' : '创建商品'" --> <!-- :okText="productList.length ? '确定' : '创建商品'" -->
<GLDialog class="single-pro" <GLDialog
bigTitle="选择商品" class="single-pro"
mode="big" bigTitle="选择商品"
:before-close="handleSingleSelectClose" mode="big"
:okText="'确定'" :before-close="handleSingleSelectClose"
:visible.sync="isSingleSelectVisible" :okText="'确定'"
@onOk="handleSingleSelectConfirm" :visible.sync="isSingleSelectVisible"
@onCancel="handleSingleSelectClose"> @onOk="handleSingleSelectConfirm"
@onCancel="handleSingleSelectClose"
>
<div style="max-height:60vh"> <div style="max-height:60vh">
<div class="noproDiv" <div
v-if="!productList.length && fnCallBack"> class="noproDiv"
v-if="!productList.length && fnCallBack"
>
<img src="@/assets/noPro.png" /> <img src="@/assets/noPro.png" />
<p class="noproP">系统暂无已创建的商品</p> <p class="noproP">系统暂无已创建的商品</p>
</div> </div>
<el-radio-group v-model="infoId" <template v-if="multiple">
v-if="productList.length" <el-checkbox-group
class="pro-group"> v-model="infoIdList"
<el-radio :class="['pro-box', item.id == infoId ? 'active' : '']" v-if="productList.length"
v-for="item in productList" class="pro-group"
:key="item.id" :max="multipleMax"
:label="item.id"> >
<img v-show="item.id == infoId" <el-checkbox
class="icon-check" :class="['pro-box', infoIdList.includes(item.id) ? 'active' : '']"
src="@/assets/icon-check.png" /> v-for="item in productList"
<img class="goods-img" :key="item.id"
:src="item.goodsImage" /> :label="item.id"
<div class="txt-box"> >
<p :title="item.goodsName" <div
class="ellipsis">{{ item.goodsName }}</p> class="icon-number icon-check"
<p class="f-s-12">销量:{{ item.saleAmount }}</p> v-show="infoIdList.includes(item.id)"
<p class="f-s-12">库存:{{ item.goodsStock }}</p> >{{infoIdList.findIndex(e => item.id == e) + 1}}</div>
<p class="f-s-12">零售价:{{ item.retailPrice }}</p> <img
<p :title="item.merchantName" class="goods-img"
class="ellipsis f-s-12">门店名称:{{ item.merchantName }}</p> :src="item.goodsImage"
</div> />
</el-radio> <div class="txt-box">
</el-radio-group> <p
:title="item.goodsName"
class="ellipsis"
>{{ item.goodsName }}</p>
<p class="f-s-12">销量:{{ item.saleAmount }}</p>
<p class="f-s-12">库存:{{ item.goodsStock }}</p>
<p class="f-s-12">零售价:{{ item.retailPrice }}</p>
<p
:title="item.merchantName"
class="ellipsis f-s-12"
>门店名称:{{ item.merchantName }}</p>
</div>
</el-checkbox>
</el-checkbox-group>
</template>
<template v-else>
<el-radio-group
v-model="infoId"
v-if="productList.length"
class="pro-group"
>
<el-radio
:class="['pro-box', item.id == infoId ? 'active' : '']"
v-for="item in productList"
:key="item.id"
:label="item.id"
>
<img
v-show="item.id == infoId"
class="icon-check"
src="@/assets/icon-check.png"
/>
<img
class="goods-img"
:src="item.goodsImage"
/>
<div class="txt-box">
<p
:title="item.goodsName"
class="ellipsis"
>{{ item.goodsName }}</p>
<p class="f-s-12">销量:{{ item.saleAmount }}</p>
<p class="f-s-12">库存:{{ item.goodsStock }}</p>
<p class="f-s-12">零售价:{{ item.retailPrice }}</p>
<p
:title="item.merchantName"
class="ellipsis f-s-12"
>门店名称:{{ item.merchantName }}</p>
</div>
</el-radio>
</el-radio-group>
</template>
</div> </div>
</GLDialog> </GLDialog>
</template> </template>
...@@ -46,13 +101,14 @@ ...@@ -46,13 +101,14 @@
// import { getGoodsList } from '@/api/modules/common' // import { getGoodsList } from '@/api/modules/common'
export default { export default {
name: 'selectSingleProDialog', name: 'selectSingleProDialog',
data() { data () {
return { return {
userInfo: {}, userInfo: {},
infoId: '', infoId: '',
minRatilPrice: '', minRatilPrice: '',
productList: [], productList: [],
fnCallBack: false fnCallBack: false,
infoIdList: []
} }
}, },
...@@ -61,26 +117,30 @@ export default { ...@@ -61,26 +117,30 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
selectedProInfo: { selectedProInfo: [Object, Array],
type: Object,
default: () => { }
},
merchantId: { merchantId: {
type: String, type: String,
required: true required: true
},
multiple: Boolean,
multipleMax: {
type: Number,
default: 5
} }
}, },
computed: {}, computed: {},
mounted() { mounted () {
const { multiple } = this
this.userInfo = this.$globalState.session this.userInfo = this.$globalState.session
this.infoId = this.selectedProInfo.id if (!multiple) this.infoId = this.selectedProInfo.id
this.getList() this.getList()
}, },
methods: { methods: {
getList() { getList () {
const { multiple, selectedProInfo } = this
var params = { var params = {
goodsStatus: 1, goodsStatus: 1,
isActivityUsing: 1, isActivityUsing: 1,
...@@ -95,6 +155,11 @@ export default { ...@@ -95,6 +155,11 @@ export default {
// console.log(res) // console.log(res)
this.fnCallBack = true this.fnCallBack = true
this.productList = res.list this.productList = res.list
if (multiple) {
selectedProInfo.length && selectedProInfo.map(e => {
if (e.id) this.infoIdList.push(e.id)
})
}
this.productList.forEach(function (item) { this.productList.forEach(function (item) {
item.saleAmount = item.goodsStatistics.saleAmount item.saleAmount = item.goodsStatistics.saleAmount
if (item.specificationDetailList && item.specificationDetailList.length > 1) { if (item.specificationDetailList && item.specificationDetailList.length > 1) {
...@@ -117,13 +182,13 @@ export default { ...@@ -117,13 +182,13 @@ export default {
item.goodsStock = item.specificationDetailList[0].stock item.goodsStock = item.specificationDetailList[0].stock
} else { } else {
item.retailPrice = (item.retailPrice / 100).toFixed(2) item.retailPrice = (item.retailPrice / 100).toFixed(2)
console.log(item.retailPrice)
item.minRatilPrice = item.retailPrice item.minRatilPrice = item.retailPrice
} }
}) })
}) })
}, },
handleSingleSelectConfirm() { handleSingleSelectConfirm () {
const { multiple, infoIdList } = this
if (!this.productList.length) { if (!this.productList.length) {
var params = { var params = {
addOrEdit: 1, addOrEdit: 1,
...@@ -136,26 +201,47 @@ export default { ...@@ -136,26 +201,47 @@ export default {
}) })
return true return true
} }
if (!this.infoId) { if (multiple) {
this.$message({ if (infoIdList.length < 1) return this.$message({
message: '请选择商品', message: '请选择商品',
type: 'error', type: 'error',
customClass: 'message-Z-zinde' customClass: 'message-Z-zinde'
}) })
return true const list = []
infoIdList.map(e => {
list.push(this.productList.find(item => item.id === e))
})
this.$emit('handleSingleSelectConfirm', list)
} else {
if (!this.infoId) {
this.$message({
message: '请选择商品',
type: 'error',
customClass: 'message-Z-zinde'
})
return true
}
var selectInfo = this.productList.find(item => item.id === this.infoId)
this.$emit('handleSingleSelectConfirm', selectInfo)
} }
var selectInfo = this.productList.find(item => item.id === this.infoId)
this.$emit('handleSingleSelectConfirm', selectInfo)
}, },
handleSingleSelectClose() { handleSingleSelectClose () {
this.$emit('handleSingleSelectClose') this.$emit('handleSingleSelectClose')
} }
} }
} }
</script> </script>
<style> <style lang="scss">
.single-pro .pro-group { .single-pro .pro-group {
margin-left: 50px; margin-left: 50px;
.el-checkbox__input {
opacity: 0 !important;
position: absolute;
}
.el-checkbox__label {
padding-left: 0 !important;
}
} }
.single-pro .pro-box { .single-pro .pro-box {
width: 202px; width: 202px;
...@@ -181,6 +267,15 @@ export default { ...@@ -181,6 +267,15 @@ export default {
width: 32px; width: 32px;
height: 32px; height: 32px;
} }
.icon-number{
background-color: #5850ff;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
border-radius: 100%;
overflow: hidden;
}
.single-pro p { .single-pro p {
margin: 0 0 8px 0; margin: 0 0 8px 0;
} }
......
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
slot="assignName" slot="assignName"
slot-scope="scope" slot-scope="scope"
> >
<div> <div class="flex-align">
<template v-if="scope.scope.assignStaffName"> <template v-if="scope.scope.assignStaffName">
<img <img
class="img-36 pointer img-circle" class="img-36 pointer img-circle"
...@@ -1876,8 +1876,12 @@ export default { ...@@ -1876,8 +1876,12 @@ export default {
margin: 0 8px 0 0 !important; margin: 0 8px 0 0 !important;
} }
} }
.el-select .el-select__tags>span{
width: 80%;
display: flex !important;
}
.el-select .el-tag { .el-select .el-tag {
max-width: 60% !important; max-width: 55% !important;
} }
.import-dialog { .import-dialog {
.el-dialog__body { .el-dialog__body {
......
...@@ -624,8 +624,12 @@ export default { ...@@ -624,8 +624,12 @@ export default {
} }
</script> </script>
<style scoped> <style>
.el-select .el-select__tags>span{
display: flex !important;
width: 80%;
}
.el-select .el-tag { .el-select .el-tag {
max-width: 60% !important; max-width: 55% !important;
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!