Browse Source

管理后台-存酒:商品名称支持搜索

panyong 3 years ago
parent
commit
f2f52a60c6

+ 1 - 0
htmldev/manage/src/layout/components/Navbar.vue

@@ -82,6 +82,7 @@ export default {
     this.$store.dispatch('common/fetchOutletList')
     this.$store.dispatch('common/fetchCategory')
     this.$store.dispatch('common/fetchGoodsAttr')
+    this.$store.dispatch('common/fetchGoodsArr')
   },
   methods: {
     modPassword () {

+ 2 - 1
htmldev/manage/src/store/getters.js

@@ -21,6 +21,7 @@ const getters = {
   roleArr: state => state.common.roleArr,
   outletList: state => state.common.outletList,
   categoryArr: state => state.common.categoryArr,
-  goodsAttrArr: state => state.common.goodsAttrArr
+  goodsAttrArr: state => state.common.goodsAttrArr,
+  goodsArr: state => state.common.goodsArr
 }
 export default getters

+ 0 - 199
htmldev/manage/src/views/business/outlet/list/details.vue

@@ -1,199 +0,0 @@
-<template>
-  <div>
-    <el-dialog :title="exData.id ? '编辑': '新增'"
-               :visible.sync="dialog"
-               width="800px"
-               :close-on-click-modal="false"
-               top="50px">
-      <el-form ref="form"
-               :model="form"
-               :rules="formRules"
-               label-width="120px">
-        <el-form-item prop="bar_name"
-                      :rules="formRules.required"
-                      label="门店名称:">
-          <el-input v-model="form.bar_name"
-                    placeholder="请输入门店名称"
-                    clearable></el-input>
-        </el-form-item>
-        <el-form-item prop="bar_address"
-                      :rules="formRules.required"
-                      label="门店地址:">
-          <el-input v-model="form.bar_address"
-                    placeholder="请输入门店地址"
-                    clearable></el-input>
-        </el-form-item>
-        <el-form-item prop="bar_img_url"
-                      :rules="formRules.uploadImgs"
-                      label="门店图片:">
-          <el-upload :on-remove="handleRemove"
-                     :on-success="handleAvatarSuccess"
-                     :before-upload="beforeAvatarUpload"
-                     :accept="'image/*'"
-                     :file-list="fileList"
-                     list-type="picture-card"
-                     action="/api/admin/v1/upload/file"
-                     multiple>
-            <i class="el-icon-plus"></i>
-            <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过5M</div>
-          </el-upload>
-        </el-form-item>
-        <el-form-item prop="bar_status"
-                      :rules="formRules.required"
-                      label="门店状态:">
-          <el-radio v-model="form.bar_status"
-                    label="1">有效
-          </el-radio>
-          <el-radio v-model="form.bar_status"
-                    label="0">无效
-          </el-radio>
-        </el-form-item>
-        <el-form-item prop="bar_song_start_time"
-                      :rules="formRules.required"
-                      label="点歌时间:">
-          <el-time-select style="width: 45%;"
-                          placeholder="起始时间"
-                          v-model="form.bar_song_start_time"
-                          :picker-options="{start: '00:00', step: '00:05', end: '23:59'}">
-          </el-time-select>
-          <span style="display:inline-block;width: 10%; text-align: center">至</span>
-          <el-time-select style="width: 45%;"
-                          placeholder="结束时间"
-                          v-model="form.bar_song_end_time"
-                          :picker-options="{start: '00:00', step: '00:05', end: '23:59', minTime: form.bar_song_start_time}">
-          </el-time-select>
-        </el-form-item>
-        <el-form-item prop="bar_place_reserve_start_time"
-                      :rules="formRules.required"
-                      label="座位预定时间:">
-          <el-time-select style="width: 45%;"
-                          placeholder="起始时间"
-                          v-model="form.bar_place_reserve_start_time"
-                          :picker-options="{start: '00:00', step: '00:05', end: '23:59'}">
-          </el-time-select>
-          <span style="display:inline-block;width: 10%; text-align: center">至</span>
-          <el-time-select style="width: 45%;"
-                          placeholder="结束时间"
-                          v-model="form.bar_place_reserve_end_time"
-                          :picker-options="{start: '00:00', step: '00:05', end: '23:59', minTime: form.bar_place_reserve_start_time}">
-          </el-time-select>
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer text-center">
-        <el-button @click="dialog = false">取 消</el-button>
-        <el-button type="primary" :disabled="booLock" @click="handleSubmit">确 定</el-button>
-      </div>
-    </el-dialog>
-  </div>
-</template>
-
-<script>
-export default {
-  components: {},
-  props: {
-    value: {
-      type: Boolean,
-      default: true
-    },
-    exData: {
-      type: Object,
-      default: function () {
-        return {}
-      }
-    }
-  },
-  data () {
-    return {
-      dialog: !!this.value,
-      form: {
-        bar_name: '', // 门店名称
-        bar_address: '', // 门店地址
-        bar_status: '1', // 门店状态(0无效1有效)
-        bar_img_url: [], // 门店图片
-        bar_song_start_time: '', // 点歌开始时间
-        bar_song_end_time: '', // 点歌结束时间
-        bar_place_reserve_start_time: '', // 座位预定开始时间
-        bar_place_reserve_end_time: '' // 座位预定结束时间
-      },
-      fileList: [],
-      booLock: false
-    }
-  },
-  methods: {
-    beforeAvatarUpload (file) {
-      const isLt2M = file.size / 1024 / 1024 < 5
-      if (!isLt2M) {
-        this.$message.error('上传图片大小不能超过 5MB!')
-      }
-      return isLt2M
-    },
-    handleRemove (file) {
-      let path = file.url
-      if (file.response && file.response.data) {
-        path = file.response.data.path
-      }
-      this.form.bar_img_url = this.form.bar_img_url.filter(item => item !== path.replace(/^\/\//, ''))
-    },
-    handleAvatarSuccess (res) {
-      if (res.code === 200) {
-        const { path } = res.data
-        this.form.bar_img_url.push(path)
-      } else {
-        this.$message.error('图片上传失败')
-      }
-    },
-    handleSubmit () {
-      const url = this.exData.id ? '/v1/bar/modify' : '/v1/bar/add'
-      this.$refs.form.validate(async valid => {
-        if (valid) {
-          this.booLock = true
-          const data = await this.$fetch(url, {
-            ...this.form
-          })
-          this.booLock = false
-          if (data.code === 200) {
-            this.$message.success('提交成功')
-            this.$emit('success')
-            this.$store.dispatch('common/fetchOutletList')
-            this.dialog = false
-          }
-        }
-      })
-    }
-  },
-  mounted () {
-    if (this.exData.id) {
-      this.$set(this.form, 'id', this.exData.id)
-      this.fileList = this.exData.bar_img_url.map(item => {
-        return {
-          name: '',
-          url: item
-        }
-      })
-      for (const key in this.exData) {
-        if (this.form.hasOwnProperty(key)) {
-          let value = this.exData[key]
-          if ((Array.isArray(value) && value.length >= 1) || (Object.prototype.toString.call(value) === '[object Object]') || (typeof value === 'string' && value) || typeof value === 'number') {
-            if (key === 'bar_status') {
-              value = value.toString()
-            }
-            this.$set(this.form, key, value)
-          }
-        }
-      }
-    }
-  },
-  watch: {
-    dialog (val) {
-      if (!val) this.$emit('input', val)
-    }
-  }
-}
-</script>
-
-<style lang="scss" scoped>
-.top-tip {
-  margin-top: -20px;
-  margin-bottom: 20px;
-}
-</style>

+ 0 - 161
htmldev/manage/src/views/business/outlet/list/index.vue

@@ -1,161 +0,0 @@
-<template>
-  <div class="padding-20">
-    <div class="search-box">
-      <el-form ref="form"
-               :inline="true"
-               :model="searchForm"
-               clearable
-               class="mt-10">
-        <el-form-item label="门店名称:">
-          <el-input
-            v-model="searchForm.bar_name"
-            placeholder="请输入门店名称"
-            clearable></el-input>
-        </el-form-item>
-        <el-form-item class="ml-10">
-          <el-button
-            icon="el-icon-search"
-            type="primary"
-            @click="searchSubmit">查询
-          </el-button>
-        </el-form-item>
-        <el-form-item class="ml-10">
-          <el-button icon="el-icon-plus"
-                     type="primary"
-                     v-permission="'business_outlet_list_add'"
-                     @click="add">新增
-          </el-button>
-        </el-form-item>
-      </el-form>
-    </div>
-    <el-table :data="tableData"
-              v-loading="tableLoading"
-              fit
-              class="marginT-10 order-table"
-              :max-height="vheight">
-      <el-table-column type="expand">
-        <template slot-scope="props">
-          <el-form label-position="left"
-                   inline
-                   class="demo-table-expand"
-                   label-width="160px">
-            <el-form-item label="编号">
-              <span>{{ props.row.id }}</span>
-            </el-form-item>
-            <el-form-item label="酒吧名称">
-              <span>{{ props.row.bar_name }}</span>
-            </el-form-item>
-            <el-form-item label="门店地址">
-              <span>{{ props.row.bar_address }}</span>
-            </el-form-item>
-            <el-form-item label="酒吧状态">
-              <span>{{ ['无效', '有效'][props.row.bar_status] }}</span>
-            </el-form-item>
-            <el-form-item label="点歌开始时间">
-              <span>{{ props.row.bar_song_start_time }}</span>
-            </el-form-item>
-            <el-form-item label="点歌结束时间">
-              <span>{{ props.row.bar_song_end_time }}</span>
-            </el-form-item>
-            <el-form-item label="酒吧座位预定开始时间">
-              <span>{{ props.row.bar_place_reserve_start_time }}</span>
-            </el-form-item>
-            <el-form-item label="酒吧座位预定结束时间">
-              <span>{{ props.row.bar_place_reserve_end_time }}</span>
-            </el-form-item>
-            <el-form-item label="门店图片">
-              <el-image style="width: 100px; height: 100px"
-                        :src="props.row.bar_img_url[0]"
-                        :preview-src-list="props.row.bar_img_url">
-              </el-image>
-            </el-form-item>
-            <el-form-item label="创建时间">
-              <span>{{ props.row.created_at }}</span>
-            </el-form-item>
-            <el-form-item label="更新时间">
-              <span>{{ props.row.updated_at }}</span>
-            </el-form-item>
-          </el-form>
-        </template>
-      </el-table-column>
-      <el-table-column label="编号" prop="id" width="160"></el-table-column>
-      <el-table-column label="酒吧名称" prop="bar_name"></el-table-column>
-      <el-table-column label="门店地址" prop="bar_address"></el-table-column>
-      <el-table-column label="酒吧状态" sortable :sort-method="() => {}" width="100">
-        <template slot-scope="scope">
-          <p>{{ ['无效', '有效'][scope.row.bar_status] }}</p>
-        </template>
-      </el-table-column>
-      <el-table-column label="操作" width="100">
-        <template slot-scope="scope">
-          <el-button type="text" v-permission="'business_outlet_list_edit'" @click="edit(scope.row)">编辑</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    <el-pagination
-      class="marginT-20"
-      @size-change="handleSizeChange"
-      @current-change="handleCurrentChange"
-      :hide-on-single-page="true"
-      :current-page="page"
-      :page-size="page_size"
-      :page-sizes="[10, 20, 100, 200, 300, 400]"
-      background
-      layout="total, sizes, prev, pager, next, jumper"
-      :total="totalCount"/>
-    <detail v-if="detailsDialog.show"
-            v-model="detailsDialog.show"
-            :exData="detailsDialog.exData"
-            @success="init"></detail>
-  </div>
-</template>
-
-<script>
-import page from '@/mixin/page'
-import detail from './details'
-
-export default {
-  mixins: [page],
-  components: {
-    detail,
-  },
-  data () {
-    return {
-      detailsDialog: {
-        show: false,
-        exData: {}
-      },
-      searchForm: {},
-      tableData: [],
-      tableUrl: '/v1/bar/list'
-    }
-  },
-  methods: {
-    add () {
-      this.detailsDialog.exData = {}
-      this.detailsDialog.show = true
-    },
-    edit (row) {
-      this.detailsDialog.exData = row
-      this.detailsDialog.show = true
-    }
-  },
-  mounted () {
-    this.init()
-  },
-}
-</script>
-
-<style lang="scss" scoped>
-.demo-table-expand {
-  .el-form-item {
-    width: 50%;
-    margin-right: 0;
-    margin-bottom: 0;
-
-    ::v-deep &__label {
-      color: #99a9bf;
-    }
-  }
-}
-</style>

+ 1 - 0
htmldev/manage/src/views/business/pms/goods/details.vue

@@ -371,6 +371,7 @@ export default {
           if (data.code === 200) {
             this.$message.success('提交成功')
             this.$emit('success')
+            this.$store.dispatch('common/fetchGoodsArr')
             this.dialog = false
           }
         }

+ 1 - 0
htmldev/manage/src/views/business/pms/goods/index.vue

@@ -212,6 +212,7 @@ export default {
         if (data.code === 200) {
           this.$message.success('删除成功')
           this.init()
+          this.$store.dispatch('common/fetchGoodsArr')
         }
       }).catch(() => {})
     }

+ 15 - 18
htmldev/manage/src/views/business/saveWine/details.vue

@@ -9,28 +9,19 @@
                :model="form"
                :rules="formRules"
                label-width="120px">
-        <!--        <el-form-item prop="storage_name"-->
-        <!--                      :rules="formRules.required"-->
-        <!--                      label="酒名:">-->
-        <!--          <el-input v-model="form.storage_name"-->
-        <!--                    placeholder="请输入酒名"-->
-        <!--                    clearable></el-input>-->
-        <!--        </el-form-item>-->
-        <el-form-item prop="storage_name" :rules="formRules.required" label="酒名:">
+        <el-form-item prop="storage_name"
+                      :rules="formRules.required"
+                      label="商品名称:">
           <el-select
             v-model="form.storage_name"
             filterable
-            remote
-            reserve-keyword
-            :remote-method="myFilterOfRule"
-            @visible-change="getDropdownOfRule($event)"
-            :loading="loading">
+            clearable
+            placeholder="请选择商品名称">
             <el-option
-              v-for="item in getMyFilterGoodsInfo"
-              :key="item.index"
-              :label="item.storage_name"
-              :value="item.id">
-              <p>商品名称</p>
+              v-for="item in goodsArr"
+              :key="item.id"
+              :label="item.product_name"
+              :value="item.product_name">
             </el-option>
           </el-select>
         </el-form-item>
@@ -94,6 +85,7 @@
 
 <script>
 import getCode from '@/views/ums/mixin/getCode'
+import { mapGetters } from 'vuex'
 
 export default {
   mixins: [getCode],
@@ -128,6 +120,11 @@ export default {
       loading: false
     }
   },
+  computed: {
+    ...mapGetters([
+      'goodsArr'
+    ])
+  },
   methods: {
     beforeAvatarUpload (file) {
       const isLt2M = file.size / 1024 / 1024 < 5