Browse Source

始宁农业管理后台:农产品管理-上架申请

panyong 2 years ago
parent
commit
dd2946f4cf

+ 1 - 1
htmldev/shiningManage/src/mixin/page.js

@@ -41,7 +41,7 @@ export default {
             }
           })
         }
-        if (['/api/admin/un/product/list'].findIndex(item => item === this.tableUrl) > -1) {
+        if (['/api/admin/un/product/list' , '/api/admin/product/list'].findIndex(item => item === this.tableUrl) > -1) {
           data.list = data.list.map(item => {
             return {
               ...item,

+ 118 - 4
htmldev/shiningManage/src/views/productManage/products/details.vue

@@ -1,13 +1,127 @@
 <template>
-  <div></div>
+  <div>
+    <el-dialog
+      :title="exData.id ? '编辑': ''"
+      :visible.sync="dialog"
+      width="800px"
+      :close-on-click-modal="false"
+      top="50px">
+      <el-form
+        ref="form"
+        :rules="formRules"
+        :model="form"
+        label-width="120px">
+        <el-form-item
+          label="审核:"
+          prop="type"
+          :rules="formRules.select">
+          <el-radio-group
+            v-model="form.type">
+            <el-radio
+              :label="item.value"
+              v-for="item in reviewStatus"
+              :key="item.value">{{ item.name }}
+            </el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item
+          label="备注:"
+          prop="product_check_remark">
+          <el-input
+            type="textarea"
+            :rows="6"
+            placeholder="请输入备注"
+            v-model="form.product_check_remark"
+            maxlength="1000"
+            show-word-limit>
+          </el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" style="text-align: center">
+        <el-button
+          @click="dialog = false">取 消
+        </el-button>
+        <el-button
+          type="primary"
+          @click="handleSubmit"
+          :disabled="booLock">保存
+        </el-button>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
 export default {
-  name: 'details'
+  props: {
+    value: {
+      type: Boolean,
+      default: true
+    },
+    exData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  data() {
+    return {
+      dialog: !!this.value,
+      form: {
+        'product_check_remark': '', // 审核备注
+        'type': '1' // 状态(1通过2未通过)
+      },
+      booLock: false
+    }
+  },
+  computed: {
+    reviewStatus() {
+      return [
+        {
+          name: '通过',
+          value: '1'
+        },
+        {
+          name: '拒绝',
+          value: '2'
+        }
+      ]
+    }
+  },
+  methods: {
+    async handleSubmit() {
+      this.$refs.form.validate(async valid => {
+        if (valid) {
+          this.booLock = true
+          const data = await this.$fetch('/api/admin/product/check', this.form)
+          if (data.code === 200) {
+            this.dialog = false
+            this.$message.success('已审核')
+            this.$emit('success')
+          }
+          this.booLock = false
+        }
+      })
+    }
+  },
+  mounted() {
+    if (this.exData.id) {
+      this.$set(this.form, 'id', this.exData.id)
+    }
+  },
+  watch: {
+    dialog(val) {
+      if (!val) this.$emit('input', val)
+    }
+  }
 }
 </script>
 
-<style scoped>
-
+<style lang="scss" scoped>
+.hide-el-upload {
+  ::v-deep .el-upload--picture-card {
+    visibility: hidden;
+  }
+}
 </style>

+ 196 - 4
htmldev/shiningManage/src/views/productManage/products/index.vue

@@ -1,13 +1,205 @@
 <template>
-  <div></div>
+  <div class="padding-20">
+    <div class="search-box">
+      <el-form ref="form" :inline="true" :model="searchForm" clearable label-width="100px" class="mt-10">
+        <el-form-item label="农户编号:">
+          <el-input v-model="searchForm.user_id" placeholder="请输入农户编号" clearable></el-input>
+        </el-form-item>
+        <el-form-item label="农户姓名:">
+          <el-input v-model="searchForm.user_name" placeholder="请输入农户姓名" clearable></el-input>
+        </el-form-item>
+        <el-form-item label="农产品名字:">
+          <el-input v-model="searchForm.product_title" placeholder="请输入农产品名字" clearable></el-input>
+        </el-form-item>
+        <el-form-item label="类型:">
+          <el-select
+            clearable
+            placeholder="请选择类型"
+            v-model="searchForm.type">
+            <el-option
+              :label="item.name"
+              :value="item.value"
+              v-for="item in arrProductSaleType"
+              :key="item.value"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="状态:">
+          <el-select
+            clearable
+            placeholder="请选择状态"
+            v-model="searchForm.product_status">
+            <el-option
+              :label="item.name"
+              :value="item.value"
+              v-for="item in arrProductStatus"
+              :key="item.value"></el-option>
+          </el-select>
+        </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>
+    </div>
+    <el-table
+      :data="tableData"
+      stripe
+      v-loading="tableLoading"
+      fit
+      class="marginT-10 order-table"
+      border
+      :max-height="vheight">
+      <el-table-column label="农产品名字" prop="product_title" min-width="200" show-overflow-tooltip></el-table-column>
+      <el-table-column label="农产品描述" prop="product_desc" min-width="200" show-overflow-tooltip></el-table-column>
+      <el-table-column label="商品主图" prop="product_img_url" min-width="100">
+        <template slot-scope="scope">
+          <el-image
+            style="display:block;width: 80px; height: 80px;font-size: 0;"
+            :src="scope.row.product_img_url"
+            :preview-src-list="[scope.row.product_img_url]">
+          </el-image>
+        </template>
+      </el-table-column>
+      <el-table-column label="商品轮播图" prop="product_rotation_img_list" min-width="100">
+        <template slot-scope="scope">
+          <template v-if="scope.row.product_rotation_img_list.length > 0">
+            <el-image
+              style="display:block;width: 80px; height: 80px;font-size: 0;"
+              :src="scope.row.product_rotation_img_list[0]"
+              :preview-src-list="scope.row.product_rotation_img_list">
+            </el-image>
+          </template>
+        </template>
+      </el-table-column>
+      <el-table-column label="商品详情图" prop="product_detail_img_list" min-width="100">
+        <template slot-scope="scope">
+          <template v-if="scope.row.product_detail_img_list.length > 0">
+            <el-image
+              style="display:block;width: 80px; height: 80px;font-size: 0;"
+              :src="scope.row.product_detail_img_list[0]"
+              :preview-src-list="scope.row.product_detail_img_list">
+            </el-image>
+          </template>
+        </template>
+      </el-table-column>
+      <el-table-column label="分类" prop="product_category_name"></el-table-column>
+      <el-table-column label="商品品牌" prop="product_brand_name"></el-table-column>
+      <el-table-column label="商品规格" prop="product_spec"></el-table-column>
+      <el-table-column label="单位" prop="product_unit"></el-table-column>
+      <el-table-column label="商品货号" prop="product_code" min-width="140"></el-table-column>
+      <el-table-column label="批发价(元)" prop="product_all_price" min-width="100">
+        <template slot-scope="scope">{{ scope.row.product_all_price | fen2Yuan }}</template>
+      </el-table-column>
+      <el-table-column label="零售价(元)" prop="product_price" min-width="100">
+        <template slot-scope="scope">{{ scope.row.product_price | fen2Yuan }}</template>
+      </el-table-column>
+      <el-table-column label="库存" prop="product_count"></el-table-column>
+      <el-table-column label="发售时间" prop="product_sale_at" min-width="160">
+        <template slot-scope="scope">{{ scope.row.product_sale_at > 0 ? scope.row.product_sale_at : '' }}</template>
+      </el-table-column>
+      <el-table-column label="类型" prop="product_sale_at">
+        <template slot-scope="scope">{{ scope.row.product_sale_at > 0 ? '现货' : '预售' }}</template>
+      </el-table-column>
+      <el-table-column label="申请人" prop="user_id" show-overflow-tooltip>
+        <template slot-scope="scope">
+          {{ scope.row.user_id }}{{ scope.row.user_name ? scope.row.user_name + '/' : '' }}
+        </template>
+      </el-table-column>
+      <el-table-column label="店铺名称" prop="shop_name" show-overflow-tooltip>
+        <template slot-scope="scope">{{ scope.row.shop_name }}</template>
+      </el-table-column>
+      <el-table-column label="审核状态" prop="product_status">
+        <template slot-scope="scope">{{ getProductStatusText(scope.row.product_status) }}</template>
+      </el-table-column>
+      <el-table-column label="申请时间" prop="created_at" min-width="160"></el-table-column>
+      <el-table-column label="操作">
+        <template slot-scope="scope">
+          <el-button type="text" @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 {
-  name: 'index'
+  mixins: [page],
+  components: {
+    detail
+  },
+  data() {
+    return {
+      detailsDialog: {
+        show: false,
+        exData: {}
+      },
+      time: [],
+      searchForm: {},
+      tableData: [],
+      tableUrl: '/api/admin/product/list'
+    }
+  },
+  computed: {
+    arrProductSaleType() {
+      return this.$store.state.common.arrProductSaleType
+    },
+    arrProductStatus() {
+      return this.$store.state.common.arrProductStatus
+    }
+  },
+  methods: {
+    add() {
+      this.detailsDialog.exData = {}
+      this.detailsDialog.show = true
+    },
+    edit(row) {
+      this.detailsDialog.exData = row
+      this.detailsDialog.show = true
+    },
+    del(row) {
+      this.$confirm('确定要删除吗', '确认', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        const data = await this.$fetch('/api/auth/department/del', { id: row.id })
+        if (data.code == 200) {
+          this.$message.success('删除成功')
+          this.init()
+        }
+      }).catch(() => {})
+    },
+    getProductStatusText(val) {
+      const index = this.arrProductStatus.findIndex(item => item.value === val)
+      if (index > -1) {
+        return this.arrProductStatus[index].name
+      }
+      return ''
+    }
+  },
+  mounted() {
+    this.init()
+  }
 }
 </script>
 
-<style scoped>
-
+<style lang="scss" scoped>
 </style>

+ 2 - 3
htmldev/shiningManage/src/views/productManage/toBeReviewed/index.vue

@@ -3,7 +3,7 @@
     <div class="search-box">
       <el-form ref="form" :inline="true" :model="searchForm" clearable label-width="100px" class="mt-10">
         <el-form-item label="农户编号:">
-          <el-input v-model="searchForm.shop_id" placeholder="请输入农户编号" clearable></el-input>
+          <el-input v-model="searchForm.user_id" placeholder="请输入农户编号" clearable></el-input>
         </el-form-item>
         <el-form-item label="农户姓名:">
           <el-input v-model="searchForm.user_name" placeholder="请输入农户姓名" clearable></el-input>
@@ -85,7 +85,6 @@
       <el-table-column label="商品品牌" prop="product_brand_name"></el-table-column>
       <el-table-column label="商品规格" prop="product_spec"></el-table-column>
       <el-table-column label="单位" prop="product_unit"></el-table-column>
-      <el-table-column label="商品货号" prop="product_code" min-width="140"></el-table-column>
       <el-table-column label="批发价(元)" prop="product_all_price" min-width="100">
         <template slot-scope="scope">{{ scope.row.product_all_price | fen2Yuan }}</template>
       </el-table-column>
@@ -93,7 +92,7 @@
         <template slot-scope="scope">{{ scope.row.product_price | fen2Yuan }}</template>
       </el-table-column>
       <el-table-column label="库存" prop="product_count"></el-table-column>
-      <el-table-column label="发售时间" prop="product_title">
+      <el-table-column label="发售时间" prop="product_sale_at" min-width="160">
         <template slot-scope="scope">{{ scope.row.product_sale_at > 0 ? scope.row.product_sale_at : '' }}</template>
       </el-table-column>
       <el-table-column label="类型" prop="product_sale_at">