|
@@ -0,0 +1,322 @@
|
|
|
|
|
+<!--
|
|
|
|
|
+ * @Descripttion: 用户选择器
|
|
|
|
|
+ * @version: 1.0
|
|
|
|
|
+ * @Author: Zory
|
|
|
|
|
+ * @Date: 2024年1月10日21:46:29
|
|
|
|
|
+-->
|
|
|
|
|
+<template>
|
|
|
|
|
+ <el-dialog :title="titleMap[mode]" v-model="visible" :width="800" destroy-on-close @closed="$emit('closed')">
|
|
|
|
|
+ <div class="main">
|
|
|
|
|
+ <div class="main-left">
|
|
|
|
|
+ <div class="main-top">
|
|
|
|
|
+ <el-form class="lv-form-inline" ref="searchForm" :model="searchKey" label-position="right">
|
|
|
|
|
+ <el-row :gutter="10">
|
|
|
|
|
+ <el-col :span="18" :xs="12">
|
|
|
|
|
+ <el-form-item label=" " prop="title">
|
|
|
|
|
+ <el-input v-model="searchKey.title" placeholder="请输入商品标题" clearable
|
|
|
|
|
+ :style="{width: '100%'}"></el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="6" :xs="12">
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <div class="search-btn">
|
|
|
|
|
+ <el-button type="primary" @click="searchForm">搜索</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="main-body-wrap" v-if="!multiple">
|
|
|
|
|
+ <scTable ref="table" :apiObj="list.apiObj" :hideSetting="true" paginationLayout="total, prev, pager, next" :params="searchKey" @current-change="handleCurrentChange" highlight-current-row :row-key="getRowKeys" @sortChange="sortChange">
|
|
|
|
|
+ <el-table-column width="50" fixed="left">
|
|
|
|
|
+ <div class="checkbox"></div>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="商品信息" width="340" prop="name">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div class="goods-img">
|
|
|
|
|
+ <div class="img">
|
|
|
|
|
+ <el-image
|
|
|
|
|
+ style="width: 54px; height: 54px"
|
|
|
|
|
+ :src="scope.row.image"
|
|
|
|
|
+ :zoom-rate="1.2"
|
|
|
|
|
+ :max-scale="7"
|
|
|
|
|
+ :min-scale="0.2"
|
|
|
|
|
+ :preview-src-list="[scope.row.image]"
|
|
|
|
|
+ preview-teleported
|
|
|
|
|
+ z-index="999"
|
|
|
|
|
+ fit="cover"></el-image>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="name">
|
|
|
|
|
+ <span>{{ scope.row.title }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="团单信息" width="340" prop="name">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div class="goods-img">
|
|
|
|
|
+ <div class="img">
|
|
|
|
|
+ <el-image
|
|
|
|
|
+ style="width: 54px; height: 54px"
|
|
|
|
|
+ :src="scope.row.goods.image_list[0].url"
|
|
|
|
|
+ :zoom-rate="1.2"
|
|
|
|
|
+ :max-scale="7"
|
|
|
|
|
+ :min-scale="0.2"
|
|
|
|
|
+ :preview-src-list="[scope.row.goods.image_list[0].url]"
|
|
|
|
|
+ preview-teleported
|
|
|
|
|
+ z-index="999"
|
|
|
|
|
+ fit="cover"></el-image>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="name">
|
|
|
|
|
+ <span>{{ scope.row.goods.product_name }}</span>
|
|
|
|
|
+ <span class="dec">商品ID:{{ scope.row.goods.goods_id }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="价格" width="200" prop="id">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div class="price">{{ $TOOL.moneyFormat(scope.row.goods.price) }}</div>
|
|
|
|
|
+ <div class="goods-price">
|
|
|
|
|
+ <div class="del">{{ $TOOL.moneyFormat(scope.row.goods.line_price) }}</div>
|
|
|
|
|
+ <span>{{ $TOOL.disFormat(scope.row.goods.price,scope.row.goods.line_price) }}折</span></div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="状态" prop="enable" width="120" align="center">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div class="status-success" v-if="scope.row.status==1"><sc-status-indicator type="success"></sc-status-indicator> 正常</div>
|
|
|
|
|
+ <div class="status-danger" v-if="scope.row.status==0"><sc-status-indicator type="danger"></sc-status-indicator> 已冻结</div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </scTable>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="main-body-wrap" v-else>
|
|
|
|
|
+ <scTable ref="table" :apiObj="list.apiObj" :hideSetting="true" paginationLayout="total, prev, pager, next" :params="searchKey" @selectionChange="selectionChange" row-key="id" @sortChange="sortChange">
|
|
|
|
|
+ <el-table-column type="selection" width="50" fixed="left"></el-table-column>
|
|
|
|
|
+ <el-table-column label="商品信息" width="340" prop="name">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div class="goods-img">
|
|
|
|
|
+ <div class="img">
|
|
|
|
|
+ <el-image
|
|
|
|
|
+ style="width: 54px; height: 54px"
|
|
|
|
|
+ :src="scope.row.image"
|
|
|
|
|
+ :zoom-rate="1.2"
|
|
|
|
|
+ :max-scale="7"
|
|
|
|
|
+ :min-scale="0.2"
|
|
|
|
|
+ :preview-src-list="[scope.row.image]"
|
|
|
|
|
+ preview-teleported
|
|
|
|
|
+ z-index="999"
|
|
|
|
|
+ fit="cover"></el-image>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="name">
|
|
|
|
|
+ <span>{{ scope.row.title }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="团单信息" width="340" prop="name">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div class="goods-img">
|
|
|
|
|
+ <div class="img">
|
|
|
|
|
+ <el-image
|
|
|
|
|
+ style="width: 54px; height: 54px"
|
|
|
|
|
+ :src="scope.row.goods.image_list[0].url"
|
|
|
|
|
+ :zoom-rate="1.2"
|
|
|
|
|
+ :max-scale="7"
|
|
|
|
|
+ :min-scale="0.2"
|
|
|
|
|
+ :preview-src-list="[scope.row.goods.image_list[0].url]"
|
|
|
|
|
+ preview-teleported
|
|
|
|
|
+ z-index="999"
|
|
|
|
|
+ fit="cover"></el-image>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="name">
|
|
|
|
|
+ <span>{{ scope.row.goods.product_name }}</span>
|
|
|
|
|
+ <span class="dec">商品ID:{{ scope.row.goods.goods_id }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="价格" width="200" prop="id">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div class="price">{{ $TOOL.moneyFormat(scope.row.goods.price) }}</div>
|
|
|
|
|
+ <div class="goods-price">
|
|
|
|
|
+ <div class="del">{{ $TOOL.moneyFormat(scope.row.goods.line_price) }}</div>
|
|
|
|
|
+ <span>{{ $TOOL.disFormat(scope.row.goods.price,scope.row.goods.line_price) }}折</span></div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="状态" prop="enable" width="120" align="center">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div class="status-success" v-if="scope.row.status==1"><sc-status-indicator type="success"></sc-status-indicator> 正常</div>
|
|
|
|
|
+ <div class="status-danger" v-if="scope.row.status==0"><sc-status-indicator type="danger"></sc-status-indicator> 已冻结</div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </scTable>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <el-button @click="visible=false" >取 消</el-button>
|
|
|
|
|
+ <el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="submit()">确 定</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script>
|
|
|
|
|
+export default{
|
|
|
|
|
+ emits: ['success', 'closed'],
|
|
|
|
|
+ props: {
|
|
|
|
|
+ multiple: { type: Boolean, default: false },
|
|
|
|
|
+ },
|
|
|
|
|
+ data(){
|
|
|
|
|
+ return {
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ mode:"add",
|
|
|
|
|
+ titleMap:{
|
|
|
|
|
+ add:"选择兑换商品",
|
|
|
|
|
+ edit:"选择兑换商品",
|
|
|
|
|
+ off:"选择兑换商品"
|
|
|
|
|
+ },
|
|
|
|
|
+ list: {
|
|
|
|
|
+ apiObj: this.$API.goodsoff.list
|
|
|
|
|
+ },
|
|
|
|
|
+ visible: false,
|
|
|
|
|
+ isSaveing: false,
|
|
|
|
|
+ formData:{},
|
|
|
|
|
+ searchKey:{
|
|
|
|
|
+ status:1
|
|
|
|
|
+ },
|
|
|
|
|
+ selectData:[]
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ methods:{
|
|
|
|
|
+ sortChange(event){
|
|
|
|
|
+ if (event.order) {
|
|
|
|
|
+ var data = {
|
|
|
|
|
+ "field":event.prop,
|
|
|
|
|
+ "order":event.order
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$refs.table.upData(data)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$refs.table.reload(this.searchKey)
|
|
|
|
|
+ }
|
|
|
|
|
+ return ;
|
|
|
|
|
+ },
|
|
|
|
|
+ submit(){
|
|
|
|
|
+ if (this.selectData.length == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return this.$message.error("请选择数据");
|
|
|
|
|
+ }
|
|
|
|
|
+ this.isSaveing = false;
|
|
|
|
|
+ this.visible = false;
|
|
|
|
|
+ if (this.multiple){
|
|
|
|
|
+ this.$emit('success', this.selectData);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$emit('success', this.selectData[0]);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ getRowKeys(data){
|
|
|
|
|
+ return data.id;
|
|
|
|
|
+ },
|
|
|
|
|
+ clearAll(){
|
|
|
|
|
+ this.selectData = [];
|
|
|
|
|
+ },
|
|
|
|
|
+ removeUser(index,name){
|
|
|
|
|
+ this.selectData.splice(index, 1);
|
|
|
|
|
+ console.log(name)
|
|
|
|
|
+ },
|
|
|
|
|
+ handleCurrentChange(data){
|
|
|
|
|
+ this.selectData = [data];
|
|
|
|
|
+ },
|
|
|
|
|
+ selectionChange(data){
|
|
|
|
|
+ this.selectData = data;
|
|
|
|
|
+ },
|
|
|
|
|
+ searchForm(){
|
|
|
|
|
+ this.$refs.table.upData(this.searchKey)
|
|
|
|
|
+ },
|
|
|
|
|
+ fristName(name){
|
|
|
|
|
+ return name.substring(0,1);
|
|
|
|
|
+ },
|
|
|
|
|
+ open(mode = 'add'){
|
|
|
|
|
+ this.mode = mode;
|
|
|
|
|
+ this.visible = true;
|
|
|
|
|
+ return this
|
|
|
|
|
+ },
|
|
|
|
|
+ //表单注入数据
|
|
|
|
|
+ setData(data){
|
|
|
|
|
+ this.formData = data;
|
|
|
|
|
+ },
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
|
+.main{
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ border: 1px solid #dfe1e6;
|
|
|
|
|
+}
|
|
|
|
|
+.main-left{
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ .main-body-wrap{
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ height: 380px;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+.main-top{
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ padding: 10px 0;
|
|
|
|
|
+ border-bottom: 1px solid #dfe1e6;
|
|
|
|
|
+ &.is-right{
|
|
|
|
|
+ height:53px;
|
|
|
|
|
+ display:flex;
|
|
|
|
|
+ align-items:center;
|
|
|
|
|
+ padding:0 10px;
|
|
|
|
|
+ justify-content:space-between;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+.main-body.is-right{
|
|
|
|
|
+ padding: 8px 16px;
|
|
|
|
|
+ overflow-y: auto;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ height: calc(100% - 53px);
|
|
|
|
|
+ max-height: 380px;
|
|
|
|
|
+}
|
|
|
|
|
+.mx-1{
|
|
|
|
|
+ margin: 0 0.5rem 0.5rem 0;
|
|
|
|
|
+}
|
|
|
|
|
+.main-right{
|
|
|
|
|
+ flex: 0.4;
|
|
|
|
|
+}
|
|
|
|
|
+.el-form-item--default{
|
|
|
|
|
+ margin-bottom: 0;
|
|
|
|
|
+}
|
|
|
|
|
+.checkbox{
|
|
|
|
|
+ border:1px solid #dfe1e6;
|
|
|
|
|
+ width: 14px;
|
|
|
|
|
+ height: 14px;
|
|
|
|
|
+ border-radius: 2px;
|
|
|
|
|
+ background-color: #fff;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ position:relative
|
|
|
|
|
+}
|
|
|
|
|
+.current-row .checkbox{
|
|
|
|
|
+ background-color: var(--el-color-primary);
|
|
|
|
|
+ border-color: var(--el-color-primary);
|
|
|
|
|
+}
|
|
|
|
|
+.current-row .checkbox:after{
|
|
|
|
|
+ transform: rotate(45deg) scaleY(1);
|
|
|
|
|
+ box-sizing: content-box;
|
|
|
|
|
+ content: "";
|
|
|
|
|
+ border: 1px solid #fff;
|
|
|
|
|
+ border-left: 0;
|
|
|
|
|
+ border-top: 0;
|
|
|
|
|
+ height: 7px;
|
|
|
|
|
+ left: 4px;
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ top: 1px;
|
|
|
|
|
+ width: 3px;
|
|
|
|
|
+ transition: transform .15s ease-in 50ms;
|
|
|
|
|
+ transform-origin: center;
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|