浏览代码

行情/行情配置后台管理页面

刘浩男 1 年之前
父节点
当前提交
35fa568c6c
共有 4 个文件被更改,包括 170 次插入41 次删除
  1. 2 2
      src/api/quotations/config.js
  2. 15 4
      src/api/quotations/quotations.js
  3. 1 1
      src/views/quotations/conf.vue
  4. 152 34
      src/views/quotations/index.vue

+ 2 - 2
src/api/quotations/config.js

@@ -12,7 +12,7 @@ export function listConfig(query) {
 // 查询行情产品配置详细
 export function getConfig(id) {
   return request({
-    url: '/quotationsConfig/' + id,
+    url: '/quotationsConfig/' + id ,
     method: 'get'
   })
 }
@@ -38,7 +38,7 @@ export function updateConfig(data) {
 // 删除行情产品配置
 export function delConfig(id) {
   return request({
-    url: '/quotationsConfig/' + id,
+    url: '/quotationsConfig/' + id ,
     method: 'delete'
   })
 }

+ 15 - 4
src/api/quotations/quotations.js

@@ -10,9 +10,9 @@ export function listQuotations(query) {
 }
 
 // 查询行情详细
-export function getQuotations(id,type) {
+export function getQuotations(id) {
   return request({
-    url: '/quotations/' + id + '/' + type,
+    url: '/quotations/' + id ,
     method: 'get'
   })
 }
@@ -36,9 +36,20 @@ export function updateQuotations(data) {
 }
 
 // 删除行情
-export function delQuotations(id,type) {
+export function delQuotations(id) {
   return request({
-    url: '/quotations/' + id + '/' + type,
+    url: '/quotations/' + id ,
     method: 'delete'
   })
 }
+
+// 修改审核状态
+export function updateStatus(data) {
+  return request({
+    url: '/quotations/status',
+    method: 'post',
+    data: data
+  })
+}
+
+

+ 1 - 1
src/views/quotations/conf.vue

@@ -281,7 +281,7 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除行情产品配置编号为"' + ids + '"的数据项?').then(function () {
+      this.$modal.confirm('是否确认删除行情产品配置').then(function () {
         return delConfig(ids);
       }).then(() => {
         this.getList();

+ 152 - 34
src/views/quotations/index.vue

@@ -32,7 +32,8 @@
           size="mini"
           @click="handleAdd"
           v-hasPermi="['jnb:quotations:add']"
-        >新增</el-button>
+        >新增
+        </el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -43,7 +44,8 @@
           :disabled="single"
           @click="handleUpdate"
           v-hasPermi="['jnb:quotations:edit']"
-        >修改</el-button>
+        >修改
+        </el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -54,34 +56,58 @@
           :disabled="multiple"
           @click="handleDelete"
           v-hasPermi="['jnb:quotations:remove']"
-        >删除</el-button>
+        >删除
+        </el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
     <el-table v-loading="loading" :data="quotationsList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="产品名称" align="center" prop="productName" />
-      <el-table-column label="地区" align="center" prop="area" />
-      <el-table-column label="类型" align="center" prop="type" />
-      <el-table-column label="价格" align="center" prop="price" />
-      <el-table-column label="地址" align="center" prop="address" />
+      <el-table-column type="selection" width="55" align="center"/>
+      <el-table-column label="产品名称" align="center" prop="productName"/>
+      <el-table-column label="地区" align="center" prop="area"/>
+      <el-table-column label="类型" align="center" prop="type"/>
+      <el-table-column label="价格" align="center" prop="price"/>
+      <el-table-column label="地址" align="center" prop="address"/>
+      <el-table-column label="审核状态" align="center" prop="status"/>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
+            v-if="scope.row.status !== '通过'"
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="updateStatus(scope.row)"
+            v-hasPermi="['jnb:quotations:edit']"
+          >审核
+          </el-button>
+          <el-button
+            v-if="scope.row.status !== '通过'"
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['jnb:quotations:edit']"
-          >修改</el-button>
+          >修改
+          </el-button>
           <el-button
+            v-if="scope.row.status !== '通过'"
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['jnb:quotations:remove']"
-          >删除</el-button>
+          >删除
+          </el-button>
+          <el-button
+            v-if="scope.row.status == '通过'"
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleUpdateStatus(scope.row)"
+            v-hasPermi="['jnb:quotations:remove']"
+          >查看
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -93,11 +119,29 @@
       @pagination="getList"
     />
 
+    <el-dialog :title="title" :visible.sync="staK" width="500px" append-to-body>
+      <el-form ref="forms" :model="forms" :rules="sta" label-width="80px">
+        <el-form-item label="审核" prop="status">
+          <el-select v-model="forms.status">
+            <el-option
+              v-for="item in statusList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submit">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
     <!-- 添加或修改行情对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-form-item label="产品名称" prop="productName">
-          <el-input v-model="form.productName" placeholder="请输入产品名称" />
+          <el-input v-model="form.productName" placeholder="请输入产品名称"/>
         </el-form-item>
         <el-form-item label="类型" prop="type">
           <el-cascader
@@ -110,22 +154,22 @@
           </el-cascader>
         </el-form-item>
         <el-form-item label="地区" prop="area">
-          <el-input v-model="form.area" placeholder="请输入地区" />
+          <el-input v-model="form.area" placeholder="请输入地区"/>
         </el-form-item>
         <el-form-item label="价格" prop="price">
-          <el-input v-model="form.price" placeholder="请输入价格" />
+          <el-input v-model="form.price" placeholder="请输入价格"/>
         </el-form-item>
         <el-form-item label="手机号" prop="phone">
-          <el-input v-model="form.phone" placeholder="请输入手机号" />
+          <el-input v-model="form.phone" placeholder="请输入手机号"/>
         </el-form-item>
         <el-form-item label="地址" prop="address">
-          <el-input v-model="form.address" placeholder="请输入地址" />
+          <el-input v-model="form.address" placeholder="请输入地址"/>
         </el-form-item>
-        <el-form-item label="图片" prop="imgUrlList">
-          <image-upload v-model="form.imgUrlList"/>
+        <el-form-item label="图片" prop="url">
+          <image-upload v-model="form.url"/>
         </el-form-item>
       </el-form>
-      <div slot="footer" class="dialog-footer">
+      <div slot="footer" class="dialog-footer" v-if="poppn">
         <el-button type="primary" @click="submitForm">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
@@ -134,7 +178,14 @@
 </template>
 
 <script>
-import { listQuotations, getQuotations, delQuotations, addQuotations, updateQuotations } from "@/api/quotations/quotations";
+import {
+  addQuotations,
+  delQuotations,
+  getQuotations,
+  listQuotations,
+  updateQuotations,
+  updateStatus
+} from "@/api/quotations/quotations";
 import {listConfig} from "@/api/quotations/config";
 
 export default {
@@ -151,7 +202,16 @@ export default {
     }
     return {
       // 类型下拉框选项
-      options:[],
+      options: [],
+      statusList: [{
+        label: '审核通过',
+        value: '1'
+      },
+        {
+          label: '审核未通过',
+          value: '2'
+        },
+      ],
       // 遮罩层
       loading: true,
       // 选中数组
@@ -170,6 +230,7 @@ export default {
       title: "",
       // 是否显示弹出层
       open: false,
+      staK: false,
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -180,20 +241,28 @@ export default {
         price: null,
         phone: null,
         address: null,
-        configId: null
+        url: null,
+        urlArray: null
       },
       // 表单参数
       form: {},
+      //审核参数
+      forms: {},
+      poppn: true,
+      sta: {
+        status: [{required: true, message: "请选择审核状态", trigger: "blur"}]
+      },
       // 表单校验
       rules: {
-        productName: [{ required: true, message: "请输入产品名称", trigger: "blur" }],
-        area: [{ required: true, message: "请输入地区", trigger: "blur" }],
+        productName: [{required: true, message: "请输入产品名称", trigger: "blur"}],
+        area: [{required: true, message: "请输入地区", trigger: "blur"}],
         price: [
-          { required: true, message: "请输入价格", trigger: "blur" },
-          { validator: validateNumber, trigger: 'blur' }
+          {required: true, message: "请输入价格", trigger: "blur"},
+          {validator: validateNumber, trigger: 'blur'}
         ],
-        phone: [{ required: true, message: "请输入手机号", trigger: "blur", pattern: /^1[34578]\d{9}$/}],
-        address: [{ required: true, message: "请输入地址", trigger: "blur" }]
+        phone: [{required: true, message: "请输入手机号", trigger: "blur", pattern: /^1[34578]\d{9}$/}],
+        address: [{required: true, message: "请输入地址", trigger: "blur"}],
+        url: [{required: true, message: "请输入图片", trigger: "blur"}]
       }
     };
   },
@@ -206,6 +275,7 @@ export default {
       this.loading = true;
       listQuotations(this.queryParams).then(response => {
         this.quotationsList = response.rows;
+        this.quotationsList.url = response.rows.urlArray
         this.total = response.total;
         this.loading = false;
       });
@@ -246,6 +316,7 @@ export default {
     // 取消按钮
     cancel() {
       this.open = false;
+      this.staK = false;
       this.reset();
     },
     // 表单重置
@@ -258,6 +329,7 @@ export default {
         price: null,
         phone: null,
         address: null,
+        url: null,
         createBy: null,
         createTime: null,
         updateBy: null,
@@ -267,6 +339,10 @@ export default {
         configId: null
       };
       this.resetForm("form");
+      this.forms = {
+        status: null
+      }
+      this.resetForm("forms");
     },
     /** 搜索按钮操作 */
     handleQuery() {
@@ -281,7 +357,7 @@ export default {
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
+      this.single = selection.length !== 1
       this.multiple = !selection.length
     },
     /** 新增按钮操作 */
@@ -294,19 +370,60 @@ export default {
     handleUpdate(row) {
       this.reset();
       const id = row.id || this.ids
-      getQuotations(id,13).then(response => {
+      getQuotations(id).then(response => {
         this.form = response.data;
         this.form.type = this.getParentsById(this.options, this.form.type)
         this.open = true;
+        this.poppn = true;
         this.title = "修改行情";
       });
     },
+    handleUpdateStatus(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getQuotations(id).then(response => {
+        this.form = response.data;
+        this.form.type = this.getParentsById(this.options, this.form.type)
+        this.open = true;
+        this.poppn = false;
+        this.title = "查看行情";
+      });
+    },
+    /** 审核按钮*/
+    updateStatus(row) {
+      this.reset();
+      this.forms.id = row.id
+      this.forms.productName = row.productName
+      this.forms.createTime = row.createTime
+      this.staK = true;
+      this.title = "行情审核";
+    },
+    submit() {
+      this.$refs["forms"].validate(valid => {
+        if (valid) {
+          // 将createTime转换为Date对象
+          let date = new Date(this.forms.createTime);
+          // 使用toLocaleString方法将Date对象转换为"YYYY-MM-DD HH:MM:SS"格式
+          this.forms.createTime = date.getFullYear() + '-' +
+            ('0' + (date.getMonth() + 1)).slice(-2) + '-' +
+            ('0' + date.getDate()).slice(-2) + ' ' +
+            ('0' + date.getHours()).slice(-2) + ':' +
+            ('0' + date.getMinutes()).slice(-2) + ':' +
+            ('0' + date.getSeconds()).slice(-2);
+          updateStatus(this.forms).then(response => {
+            this.$modal.msgSuccess("修改成功");
+            this.staK = false;
+            this.getList();
+          });
+        }
+      });
+    },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.id != null) {
-    //判断this.form.type是否是数组,如果是数组则取数组的最后一个值
+            //判断this.form.type是否是数组,如果是数组则取数组的最后一个值
             if (Array.isArray(this.form.type)) {
               this.form.type = this.form.type[this.form.type.length - 1]
             }
@@ -328,12 +445,13 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除所选的数据项?').then(function() {
-        return delQuotations(ids,13);
+      this.$modal.confirm('是否确认删除所选的数据项?').then(function () {
+        return delQuotations(ids);
       }).then(() => {
         this.getList();
         this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
+      }).catch(() => {
+      });
     },
   }
 };