Browse Source

no message

linwenxin 1 năm trước cách đây
mục cha
commit
d8e7cb500e

+ 2 - 2
.env.development

@@ -3,8 +3,8 @@ ENV = 'development'
 #base
 VUE_APP_BASE = 'https://jiasm.zfire.top'
 # base api
-# VUE_APP_BASE_API = 'https://fw.gd-jxm.com/gateway/pcapi/'
-# VUE_APP_BASE_OSS = 'https://fw.gd-jxm.com/gateway/pcapi/img/get?key='
+
+VUE_APP_BASE_OSS = 'https://jiasm.zfire.top/zfapi/img/get?key='
 
 VUE_APP_BASE_API = 'https://jiasm.zfire.top/zfapi/'
 

+ 2 - 0
.env.staging

@@ -6,6 +6,8 @@ ENV = 'staging'
 #base
 VUE_APP_BASE = 'https://jiasm.zfire.top'
 
+VUE_APP_BASE_OSS = 'https://jiasm.zfire.top/zfapi/img/get?key='
+
 # base api
 VUE_APP_BASE_API = 'https://jiasm.zfire.top/zfapi/'
 

+ 9 - 0
src/api/common.js

@@ -22,4 +22,13 @@ export function getCompanyList(params) {
     method: 'get',
     params
   })
+}
+
+// 获取oss配置
+export function getOssConfig(params) {
+  return request({
+    url: '/common/oss/config',
+    method: 'get',
+    params
+  })
 }

+ 155 - 0
src/api/miniapp.js

@@ -0,0 +1,155 @@
+import request, { postBlob } from '@/utils/request'
+
+export function chargingStandardList2(data) {
+  return request({
+    url: `/charging/standard/list2?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+
+
+
+// 获取列表
+export function getList(params) {
+  return request({
+    url: '/notice/list',
+    method: 'get',
+    params
+  })
+}
+
+// 获取列表 - 首页配置
+export function getHomeList(params) {
+  return request({
+    url: '/index/list',
+    method: 'get',
+    params
+  })
+}
+
+// 获取详情 - 首页配置
+export function getHomeDetail(params) {
+  return request({
+    url: '/index/detail',
+    method: 'get',
+    params
+  })
+}
+
+// 修改 - 首页配置
+export function editHome(params) {
+  return request({
+    url: '/index/update',
+    method: 'post',
+    params
+  })
+}
+
+// 获取列表 - 服务品牌
+export function getBrandList(params) {
+  return request({
+    url: '/brand/list',
+    method: 'get',
+    params
+  })
+}
+
+// 获取详情 - 服务品牌
+export function getBrandDetail(params) {
+  return request({
+    url: '/brand/detail',
+    method: 'get',
+    params
+  })
+}
+
+// 保存 - 服务品牌
+export function saveBrand(params) {
+  return request({
+    url: '/brand/save',
+    method: 'post',
+    data: params
+  })
+}
+
+// 删除 - 服务品牌
+export function deleteBrand(params) {
+  return request({
+    url: '/brand/delete',
+    method: 'post',
+    params
+  })
+}
+
+// 获取列表 - 业务类型
+export function getTypeList(params) {
+  return request({
+    url: '/charging/standard/type/list',
+    method: 'get',
+    params
+  })
+}
+
+// 获取详情 - 业务类型
+export function getTypeDetail(params) {
+  return request({
+    url: '/charging/standard/type/detail',
+    method: 'get',
+    params
+  })
+}
+
+// 保存 - 业务类型
+export function saveType(params) {
+  return request({
+    url: '/charging/standard/type/save',
+    method: 'post',
+    data: params
+  })
+}
+
+// 删除 - 业务类型
+export function deleteType(params) {
+  return request({
+    url: '/charging/standard/type/delete',
+    method: 'post',
+    params
+  })
+}
+
+// 获取列表 - 收费标准/故障排查
+export function getMainList(params) {
+  return request({
+    url: '/charging/standard/list',
+    method: 'get',
+    params
+  })
+}
+
+// 获取详情 - 收费标准/故障排查
+export function getMainDetail(params) {
+  return request({
+    url: '/charging/standard/detail',
+    method: 'get',
+    params
+  })
+}
+
+// 保存 - 收费标准/故障排查
+export function saveMain(params) {
+  return request({
+    url: '/charging/standard/save',
+    method: 'post',
+    data: params
+  })
+}
+
+// 删除 - 收费标准/故障排查
+export function deleteMain(params) {
+  return request({
+    url: '/charging/standard/delete',
+    method: 'post',
+    params
+  })
+}

+ 20 - 24
src/components/file-upload/index.vue

@@ -1,14 +1,13 @@
 <template>
   <div>
-    <el-upload name="file" :class="['uploader', uid]" :action="baseURL + 'common/upload'" :multiple="false"
-      :accept="accept" :show-file-list="false" :on-success="uploadSuccess" :before-upload="beforeUpload"
-      :headers="myHeaders" />
+    <el-upload name="file" :class="['uploader', uid]" :action="oss_url" :data="dataObj" :multiple="multiple"
+      :accept="accept" :show-file-list="false" :on-success="uploadSuccess" :before-upload="beforeUpload" />
     <div class="images" v-if="modType === 'view'">
       <div v-for="(item, index) in files" :key="index" class="item">
         <div v-if="item.url" class="img">
-          <el-image v-if="checkFileType(item.url) == 'image'" ref="img" :src="item.url" :preview-src-list="previewImages"
-            style="width: 120px; height: 120px" fit="cover" />
-          <el-image v-else ref="img" :src="item.url" style="width: 120px; height: 120px" fit="cover">
+          <el-image v-if="checkFileType(item.url) == 'image'" ref="img" :src="imageURL + item.url"
+            :preview-src-list="previewImages" style="width: 120px; height: 120px" fit="cover" />
+          <el-image v-else ref="img" :src="imageURL + item.url" style="width: 120px; height: 120px" fit="cover">
             <div slot="error" class="image-slot">
               <img v-if="checkFileType(item.url) == 'word'" class="file" src="@/assets/common/word.png" />
               <img v-if="checkFileType(item.url) == 'excel'" class="file" src="@/assets/common/excel.png" />
@@ -46,7 +45,7 @@
 <script>
 import { getOssConfig } from '@/api/common'
 import { findElem } from '@/utils/util'
-import { getToken } from '@/utils/auth'
+
 export default {
   name: 'FileUpload',
   props: {
@@ -99,13 +98,11 @@ export default {
   },
   data() {
     return {
-      myHeaders: { 'x-token': getToken() },
-      baseURL: process.env.VUE_APP_BASE_API,
       imageURL: this.$imageUrl,
       oss_url: '',
       dataObj: {},
       uploadImageUrl: '',
-      // waitUploadList: [],
+      waitUploadList: [],
       fileName: '',
       files: this.fileList
     }
@@ -144,7 +141,7 @@ export default {
       if (this.files && this.files.length > 0) {
         this.files.forEach(item => {
           if (this.checkFileType(item.url) == 'image') {
-            fileList.push(item.url)
+            fileList.push(this.imageURL + item.url)
           }
         })
       }
@@ -162,10 +159,9 @@ export default {
     }
   },
   created() {
-    // console.log(getOssConfig)
-    // getOssConfig().then(res => {
-    //   this.oss_url = res.data.host
-    // })
+    getOssConfig().then(res => {
+      this.oss_url = res.data.host
+    })
   },
   methods: {
     getUUID() {
@@ -240,8 +236,8 @@ export default {
       })
       this.getFileName(file.name)
       this.$emit('handleIsFileName', this.fileName)
-      // this.dataObj = await this.getOssConfig(this.fileName)
-      // this.waitUploadList.push(this.dataObj)
+      this.dataObj = await this.getOssConfig(this.fileName)
+      this.waitUploadList.push(this.dataObj)
     },
     // 文件上传成功
     uploadSuccess(res, file) {
@@ -254,22 +250,22 @@ export default {
       if (this.uploadImageUrl) {
         const index = findElem(this.files, 'url', this.uploadImageUrl)
         this.$set(this.files, index, {
-          name: file.name,
-          url: res.data.url,
+          name: this.dataObj.name,
+          url: this.dataObj.key,
           size: file.size,
           type: file.name.split(".")[file.name.split(".").length - 1]
         })
-        // this.waitUploadList = []
+        this.waitUploadList = []
       } else {
         this.getFileName(file.name)
-        // const index = findElem(this.waitUploadList, 'name', this.fileName)
+        const index = findElem(this.waitUploadList, 'name', this.fileName)
         this.files.push({
-          name: file.name,
-          url: res.data.url,
+          name: this.waitUploadList[index].name,
+          url: this.waitUploadList[index].key,
           size: file.size,
           type: file.name.split(".")[file.name.split(".").length - 1]
         })
-        // this.waitUploadList.splice(index, 1)
+        this.waitUploadList.splice(index, 1)
       }
       this.showFileList = true
       loading.close()

+ 2 - 2
src/main.js

@@ -125,8 +125,8 @@ import CopyButton from '@/components/Common/copy-button.vue'
 Vue.component('CopyButton', CopyButton)
 import Collapse from '@/components/Common/collapse'
 Vue.component('Collapse', Collapse)
-Vue.prototype.$imageUrl = process.env.VUE_APP_BASE_API + '/common/img/get?key=';
-Vue.prototype.$xdocUrl = 'https://pgxtadm.greeapps.com/preview/onlinePreview?url=';
+Vue.prototype.$imageUrl = process.env.VUE_APP_BASE_OSS;
+Vue.prototype.$xdocUrl = 'https://pgxtadm.greeapps.com/preview/onlinePreview?url='
 
 
 Vue.prototype.$findElem = findElem;

+ 308 - 0
src/views/mallManagement/configCenter/chargingStandard/index.vue

@@ -0,0 +1,308 @@
+<template>
+  <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
+    :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
+    :operation="operation">
+    <el-dialog title="" width="500px" custom-class="diy-dialog" append-to-body :modal="true" :visible.sync="formDialog"
+      :show-close="true" :close-on-click-modal="false" :modal-append-to-body="false" :before-close="formCancel">
+      <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
+        <zj-form-module :title="formDialogTitles[formDialogType]" label-width="120px" :showPackUp="false"
+          :form-data="formData" :form-items="formItems">
+        </zj-form-module>
+      </zj-form-container>
+      <div slot="footer" class="dialog-footer">
+        <el-button size="mini" @click="formCancel">取 消</el-button>
+        <el-button v-if="this.formDialogType !== 2" size="mini" @click="formConfirm" type="primary">确 定</el-button>
+      </div>
+    </el-dialog>
+  </template-page>
+</template>
+
+<script>
+import TemplatePage from '@/components/template/template-page-1.vue'
+import import_mixin from '@/components/template/import_mixin.js'
+import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
+import { chargingStandardList2, getMainList, getMainDetail, saveMain, deleteMain, getTypeList, getBrandList } from "@/api/miniapp";
+import { getClassifyList } from '@/api/goods'
+import ImageUpload from '@/components/file-upload'
+export default {
+  components: { TemplatePage, ImageUpload },
+  mixins: [import_mixin],
+  data() {
+    return {
+      // 事件组合
+      optionsEvensGroup: [
+        [
+          [
+            {
+              name: '添加收费标准',
+              isRole: true,
+              click: this.addData
+            }
+          ],
+        ],
+      ],
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: false
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      // 勾选选中行
+      recordSelected: [],
+      /** 表单变量 */
+      formDialogType: 0,
+      formDialogTitles: ["新增", "编辑", "查看"],
+      formDialog: false,
+      formData: {
+        chargingStandardTypeId: "",
+        brandId: "",
+        oneCategoryId: "",
+        twoCategoryId: "",
+        status: true,
+        imageUrl: [],
+      },
+      businessTypeList: [], // 业务类型列表
+      brandList: [], // 品牌列表
+      mainList: [], // 一级分类列表
+      smallList: [], // 二级分类列表
+    }
+  },
+  computed: {
+    isService() {
+      if (this.formData.receiveCrowd == 3) {
+        return true;
+      }
+      if (this.formData.receiveCrowd == 2 && this.memberType == 'SERVICE') {
+        return true;
+      }
+      return false;
+    },
+    memberType() {
+      if (this.formData.userList.length > 0) {
+        return this.formData.userList[0].type;
+      } else {
+        return '';
+      }
+    },
+    // 更多参数
+    moreParameters() {
+      return []
+    },
+    formItems() {
+      return [{
+        md: 24,
+        isShow: true,
+        name: 'el-select',
+        options: this.businessTypeList,
+        attributes: { filterable: true, placeholder: '请选择', disabled: this.formDialogType == 2, },
+        formItemAttributes: {
+          label: '业务类型',
+          prop: 'chargingStandardTypeId',
+          rules: [...required]
+        }
+      },
+      {
+        md: 24,
+        isShow: true,
+        name: 'el-select',
+        options: this.brandList,
+        attributes: { filterable: true, placeholder: '请选择', disabled: this.formDialogType == 2, },
+        formItemAttributes: {
+          label: '服务品牌',
+          prop: 'brandId',
+          rules: [...required]
+        }
+      },
+      {
+        md: 24,
+        isShow: true,
+        name: 'el-select',
+        options: this.mainList,
+        attributes: { filterable: true, placeholder: '请选择', disabled: this.formDialogType == 2, },
+        formItemAttributes: {
+          label: '一级分类',
+          prop: 'oneCategoryId',
+          rules: [...required]
+        },
+        events: {
+          change: async val => {
+            this.smallList = []
+            this.formData.twoCategoryId = ""
+            if (val) {
+              this.smallList = this.mainList.find(item => {
+                return item.value == val;
+              }).data.children.map(item => ({
+                label: item.name,
+                value: item.categoryId,
+                data: item
+              }));
+            }
+          }
+        }
+      },
+      {
+        md: 24,
+        isShow: true,
+        name: 'el-select',
+        options: this.smallList,
+        attributes: { filterable: true, placeholder: '请选择', disabled: this.formDialogType == 2, },
+        formItemAttributes: {
+          label: '二级分类',
+          prop: 'twoCategoryId',
+          rules: [...required]
+        }
+      },
+      {
+        md: 24,
+        isShow: true,
+        name: 'el-radio',
+        options: [{ label: "开启", value: true }, { label: "禁用", value: false }],
+        attributes: { filterable: true, placeholder: '请选择', disabled: this.formDialogType == 2 },
+        formItemAttributes: {
+          label: '优惠券类型',
+          prop: 'status',
+          rules: [...required]
+        }
+      },
+      {
+        md: 24,
+        isShow: true,
+        name: 'slot-component',
+        formItemAttributes: {
+          label: '图片',
+          prop: 'imageUrl',
+          rules: [...required]
+        },
+        render: (h, { props, onInput }) => {
+          var { value } = props
+          return (
+            <ImageUpload fileList={this.formData.imageUrl} uid="imgSrc_chargingStandard_materials_drawing_images" limit={1} isEdit={this.formDialogType !== 2} />
+          )
+        }
+      },
+      ]
+    }
+  },
+  methods: {
+    // 列表请求函数
+    getList: chargingStandardList2,
+    // 列表导出函数
+    exportList() { },
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
+    },
+    // 监听勾选变化
+    selectionChange(data) {
+      this.recordSelected = data
+    },
+    // 表格操作列
+    operation(h, { row, index, column }) {
+      return (
+        <div class='operation-btns'>
+          <el-button type="text" onClick={() => {
+            getMainDetail({ id: row.id }).then(res => {
+              Object.assign(this.formData, res.data, {
+                imageUrl: res.data.imageUrl ? [{ url: res.data.imageUrl }] : [],
+              })
+              this.formDialogType = 2
+              this.openForm()
+            })
+          }}>查看</el-button>
+          {row.releaseFlag === 'WAIT' ? <el-button type="text" onClick={() => {
+            getMainDetail({ id: row.id }).then(res => {
+              Object.assign(this.formData, res.data, {
+                imageUrl: res.data.imageUrl ? [{ url: res.data.imageUrl }] : [],
+              })
+              this.formDialogType = 1
+              this.openForm()
+            })
+          }}>编辑</el-button> : null}
+          <el-popconfirm
+            title="确定删除吗?"
+            onConfirm={() => {
+              deleteMain({ id: row.id }).then(res => {
+                this.$message({
+                  type: 'success',
+                  message: `删除成功!`,
+                })
+                this.$refs.pageRef.refreshList()
+              })
+            }}
+          >
+            <el-button type="text" slot="reference">删除</el-button>
+          </el-popconfirm>
+        </div>
+      )
+    },
+    addData() {
+      this.formDialogType = 0
+      this.openForm()
+    },
+    openForm() {
+      Promise.all([
+        getTypeList(),
+        getBrandList(),
+        getClassifyList({
+          type: 2,
+          name: '',
+        })
+      ]).then(([res1, res2, res3]) => {
+        this.businessTypeList = res1.data.map(item => ({
+          label: item.name,
+          value: item.id,
+          data: item
+        }));
+        this.brandList = res2.data.map(item => ({
+          label: item.brandName,
+          value: item.id,
+          data: item
+        }));
+        this.mainList = res3.data.map(item => ({
+          label: item.name,
+          value: item.categoryId,
+          data: item
+        }));
+        if (this.formData.oneCategoryId) {
+          this.smallList = this.mainList.find(item => {
+            return item.value == this.formData.oneCategoryId;
+          })?.data?.children?.map(item => ({
+            label: item.name,
+            value: item.categoryId,
+            data: item
+          })) || [];
+        }
+        this.formDialog = true;
+      })
+    },
+    formCancel() {
+      this.$refs.formRef.$refs.inlineForm.clearValidate()
+      this.$data.formData = this.$options.data().formData
+      this.formDialog = false
+    },
+    formConfirm() {
+      this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
+        if (valid) {
+          var pam = {
+            ...this.formData,
+            imageUrl: this.formData.imageUrl.map(item => item.url).join(","),
+          };
+          saveMain(pam).then(res => {
+            this.$message({
+              type: 'success',
+              message: this.formDialogTitles[this.formDialogType] + `成功!`,
+            })
+            this.formCancel()
+            this.$refs.pageRef.refreshList()
+          })
+        }
+      })
+    },
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>