浏览代码

销售公司更新 9.6 zyp

阿拉蕾 1 年之前
父节点
当前提交
5dc5948e45

+ 53 - 0
src/api/qw/account.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询企微功能账号管理列表
+export function listAccount(query) {
+  return request({
+    url: '/qw/account/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询企微功能账号管理详细
+export function getAccount(id) {
+  return request({
+    url: '/qw/account/' + id,
+    method: 'get'
+  })
+}
+
+// 新增企微功能账号管理
+export function addAccount(data) {
+  return request({
+    url: '/qw/account',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改企微功能账号管理
+export function updateAccount(data) {
+  return request({
+    url: '/qw/account',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除企微功能账号管理
+export function delAccount(id) {
+  return request({
+    url: '/qw/account/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出企微功能账号管理
+export function exportAccount(query) {
+  return request({
+    url: '/qw/account/export',
+    method: 'get',
+    params: query
+  })
+}

+ 11 - 0
src/api/qw/login.js

@@ -0,0 +1,11 @@
+import request from '@/utils/request'
+
+
+//获取二维码
+export function getQrCode(deviceId) {
+  return request({
+    url: '/qw/login/getQrCode/' + deviceId,
+    method: 'get'
+  })
+}
+

+ 8 - 0
src/api/store/storeOrder.js

@@ -112,3 +112,11 @@ export function bindCustomer(data) {
   })
   })
 }
 }
 
 
+export function uploadCredentials(data) {
+  return request({
+    url: '/store/storeOrder/uploadCredentials',
+    method: 'post',
+    data: data
+  })
+}
+

+ 226 - 0
src/components/ImageUpload/index.vue

@@ -0,0 +1,226 @@
+<template>
+  <div class="component-upload-image">
+    <el-upload
+      multiple
+      :action="uploadImgUrl"
+      list-type="picture-card"
+      :on-success="handleUploadSuccess"
+      :before-upload="handleBeforeUpload"
+      :limit="limit"
+      :on-error="handleUploadError"
+      :on-exceed="handleExceed"
+      ref="imageUpload"
+      :on-remove="handleDelete"
+      :show-file-list="true"
+      :file-list="fileList"
+      :on-preview="handlePictureCardPreview"
+      :class="{hide: this.fileList.length >= this.limit}"
+      :data="{type: 1}"
+    >
+      <i class="el-icon-plus"></i>
+    </el-upload>
+
+    <!-- 上传提示 -->
+    <div class="el-upload__tip" slot="tip" v-if="showTip">
+      请上传
+      <template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
+      <template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
+      的文件
+    </div>
+
+    <el-dialog
+      :visible.sync="dialogVisible"
+      title="预览"
+      width="800"
+      append-to-body
+    >
+      <img
+        :src="dialogImageUrl"
+        style="display: block; max-width: 100%; margin: 0 auto"
+      />
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getToken } from "@/utils/auth";
+import FormMakingCommon from "form-making";
+
+export default {
+  props: {
+    value: [String, Object, Array],
+    // 图片数量限制
+    limit: {
+      type: Number,
+      default: 5,
+    },
+    // 大小限制(MB)
+    fileSize: {
+       type: Number,
+      default: 5,
+    },
+    // 文件类型, 例如['png', 'jpg', 'jpeg']
+    fileType: {
+      type: Array,
+      default: () => ["png", "jpg", "jpeg"],
+    },
+    // 是否显示提示
+    isShowTip: {
+      type: Boolean,
+      default: true
+    }
+  },
+  data() {
+    return {
+      number: 0,
+      uploadList: [],
+      dialogImageUrl: "",
+      dialogVisible: false,
+      hideUpload: false,
+      baseUrl: process.env.VUE_APP_BASE_API,
+      uploadImgUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS", // 上传的图片服务器地址
+      headers: {
+        Authorization: "Bearer " + getToken(),
+      },
+      fileList: []
+    };
+  },
+  watch: {
+    value: {
+      handler(val) {
+        if (val) {
+          // 首先将值转为数组
+          const list = Array.isArray(val) ? val : this.value.split(',');
+          // 然后将数组转为对象数组
+          this.fileList = list.map(item => {
+            if (typeof item === "string") {
+              item = { name: item, url: item };
+            }
+            return item;
+          });
+        } else {
+          this.fileList = [];
+          return [];
+        }
+      },
+      deep: true,
+      immediate: true
+    }
+  },
+  computed: {
+    // 是否显示提示
+    showTip() {
+      return this.isShowTip && (this.fileType || this.fileSize);
+    },
+  },
+  methods: {
+    // 上传前loading加载
+    handleBeforeUpload(file) {
+      let isImg = false;
+      if (this.fileType.length) {
+        let fileExtension = "";
+        if (file.name.lastIndexOf(".") > -1) {
+          fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
+        }
+        isImg = this.fileType.some(type => {
+          if (file.type.indexOf(type) > -1) return true;
+          if (fileExtension && fileExtension.indexOf(type) > -1) return true;
+          return false;
+        });
+      } else {
+        isImg = file.type.indexOf("image") > -1;
+      }
+
+      if (!isImg) {
+        this.$message.error(`文件格式不正确, 请上传${this.fileType.join("/")}图片格式文件!`);
+        return false;
+      }
+      if (this.fileSize) {
+        const isLt = file.size / 1024 / 1024 < this.fileSize;
+        if (!isLt) {
+          this.$message.error(`上传头像图片大小不能超过 ${this.fileSize} MB!`);
+          return false;
+        }
+      }
+      // this.$message.loading("正在上传图片,请稍候...");
+      
+      this.number++;
+    },
+    // 文件个数超出
+    handleExceed() {
+      this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`);
+    },
+    // 上传成功回调
+    handleUploadSuccess(res, file) {
+      console.log(res)
+      console.log(file)
+      if (res.code === 200) {
+        this.uploadList.push({ name: file.name, url: res.url });
+        this.uploadedSuccessfully();
+      } else {
+        this.number--;
+        this.$message.closeLoading();
+        this.$message.error(res.msg);
+        this.$refs.imageUpload.handleRemove(file);
+        this.uploadedSuccessfully();
+      }
+    },
+    // 删除图片
+    handleDelete(file) {
+      const findex = this.fileList.map(f => f.name).indexOf(file.name);
+      if(findex > -1) {
+        this.fileList.splice(findex, 1);
+        this.$emit("input", this.listToString(this.fileList));
+      }
+    },
+    // 上传失败
+    handleUploadError() {
+      this.$message.error("上传图片失败,请重试");
+      this.$message.closeLoading();
+    },
+    // 上传结束处理
+    uploadedSuccessfully() {
+      if (this.number > 0 && this.uploadList.length === this.number) {
+        this.fileList = this.fileList.concat(this.uploadList);
+        this.uploadList = [];
+        this.number = 0;
+        this.$emit("input", this.listToString(this.fileList));
+        //this.$message.closeLoading();
+      }
+    },
+    // 预览
+    handlePictureCardPreview(file) {
+      this.dialogImageUrl = file.url;
+      this.dialogVisible = true;
+    },
+    // 对象转成指定字符串分隔
+    listToString(list, separator) {
+      let strs = "";
+      separator = separator || ",";
+      for (let i in list) {
+        if (list[i].url) {
+          strs += list[i].url.replace(this.baseUrl, "") + separator;
+        }
+      }
+      return strs != '' ? strs.substr(0, strs.length - 1) : '';
+    }
+  }
+};
+</script>
+<style scoped lang="scss">
+// .el-upload--picture-card 控制加号部分
+::v-deep.hide .el-upload--picture-card {
+    display: none;
+}
+// 去掉动画效果
+::v-deep .el-list-enter-active,
+::v-deep .el-list-leave-active {
+    transition: all 0s;
+}
+
+::v-deep .el-list-enter, .el-list-leave-active {
+    opacity: 0;
+    transform: translateY(0);
+}
+</style>
+

+ 3 - 1
src/main.js

@@ -15,6 +15,8 @@ import router from './router'
 import permission from './directive/permission'
 import permission from './directive/permission'
 
 
 import VueClipboard from 'vue-clipboard2'
 import VueClipboard from 'vue-clipboard2'
+//图片上传组件
+import ImageUpload from "@/components/ImageUpload"
 
 
 import './assets/icons' // icon
 import './assets/icons' // icon
 import './permission' // permission control
 import './permission' // permission control
@@ -35,7 +37,7 @@ Vue.use(VueClipboard)
 
 
 Vue.use(FormMaking)
 Vue.use(FormMaking)
 // 全局方法挂载
 // 全局方法挂载
-
+Vue.component('ImageUpload',ImageUpload)
 import audio from 'vue-mobile-audio'
 import audio from 'vue-mobile-audio'
 Vue.use(audio)
 Vue.use(audio)
 
 

+ 0 - 0
src/views/qw/components


+ 244 - 0
src/views/qw/qwAccounts/index.vue

@@ -0,0 +1,244 @@
+<template>
+  <div class="app-container">
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          icon="el-icon-add"
+          size="mini"
+          :disabled="multiple"
+          @click="handleAdd"
+          v-hasPermi="['qw:account:add']"
+        >添加账号</el-button>
+      </el-col>
+    </el-row>
+    <el-table v-loading="loading" :data="accountList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="序号"  width="55" type="index" align="center" />
+      <el-table-column label="id" align="center" prop="id" />
+      <el-table-column label="企微账号" align="center" prop="userName" />
+      <el-table-column label="姓名" align="center" prop="nickName" />
+      <el-table-column label="手机号码" align="center" prop="phone" />
+      <el-table-column label="归属公司" align="center" prop="companyName" />
+      <el-table-column label="归属员工" align="center" prop="companyUserName" />
+      <el-table-column width="500" label="关联设备id" align="center" prop="deviceId"  v-if="queryParams.isAudit == 1"/>
+      <el-table-column label="备注" align="center" prop="remark" />
+      
+    </el-table>
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
+        
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="form.remark"  type="textarea" :row="5"  />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listAccount, getAccount, delAccount, addAccount, auditAccount, exportAccount } from "@/api/qw/account";
+import { getCompanyList } from "@/api/company/company";
+
+export default {
+  name: "Account",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      companys:[],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      activeName:"1",
+      // 企微功能账号管理表格数据
+      accountList: [],
+      isAuditOptions:[],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        userName: null,
+        passWord: null,
+        phone: null,
+        email: null,
+        status: null,
+        realName: null,
+        nickName: null,
+        companyId: null,
+        deviceId: null,
+        deptId: null,
+        companyUserId: null,
+        isAudit: 0,
+      },
+      // 表单参数
+      form: {},
+      auditForm:{
+        id:null,
+        isAudit: null,
+        deviceId: null,
+      },
+      // 表单校验
+      rules: {
+        deviceId: [
+          { required: true, message: "关联设备id不能为空", trigger: "blur" }
+        ],
+        isAudit: [
+          { required: true, message: "是否审核不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+    getCompanyList().then(response => {
+      this.companys = response.data;
+    });
+    this.getDicts("common_audit").then((response) => {
+      this.isAuditOptions = response.data;
+    });
+  },
+  methods: {
+    /** 查询企微功能账号管理列表 */
+    getList() {
+      this.loading = true;
+      listAccount(this.queryParams).then(response => {
+        this.accountList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        userName: null,
+        passWord: null,
+        phone: null,
+        email: null,
+        createTime: null,
+
+        remark: null,
+        realName: null,
+        nickName: null,
+        companyId: null,
+        deviceId: null,
+        deptId: null,
+        companyUserId: null,
+        isAudit: null,
+        updateTime: null
+      };
+      this.resetForm("form");
+    },
+    handleClick(tab, event) {
+      this.queryParams.isAudit=tab.name;
+      this.getList();
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加企微功能账号管理";
+    },
+    
+    handleAudit(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getAccount(id).then(response => {
+        this.form = response.data;
+        this.form.companyName = row.companyName;
+        this.form.companyUserName = row.companyUserName;
+        this.form.isAudit="1"
+        this.open = true;
+        this.title = "账号审核";
+      });
+    },
+   /** 提交按钮 */
+   submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          auditAccount(this.form).then(response => {
+            if (response.code === 200) {
+              this.msgSuccess("审核成功");
+              this.open = false;
+              this.getList();
+            }
+          });
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除企微功能账号管理编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delAccount(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(function() {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有企微功能账号管理数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return exportAccount(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+        }).catch(function() {});
+    }
+  }
+};
+</script>

+ 135 - 0
src/views/qw/qwLogin/index.vue

@@ -0,0 +1,135 @@
+<template>
+  <div class="scan-login">
+    <el-row align="middle" justify="center">
+      <el-col :span="8">
+        <el-card class="scan-card" shadow="hover">
+          <div class="scan-card-content">
+            <h1 class="title">扫码登录</h1>
+            <el-input v-model="account" placeholder="请输入账号"></el-input>
+            <el-button type="primary" @click="login" :disabled="!deviceId">登录</el-button>
+            <div class="qrcode-container" v-show="showQRCode">
+              <div class="qrcode" ref="qrcodeContainer"></div>
+              <div v-if="!loading" class="qrcode-refresh" @click="getQRCode">
+                <i class="el-icon-refresh"></i>
+                <span>刷新二维码</span>
+              </div>
+            </div>
+          </div>
+        </el-card>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import QRCode from 'qrcodejs2';
+import { getQrCode, getDeviceIdByAccount } from '@/api/qw/login';
+
+export default {
+  data() {
+    return {
+      account: '', // 用户输入的账号
+      qrcode: null, // 二维码实例
+      loading: false, // 刷新按钮加载状态
+      deviceId: '', // 账号关联的 deviceId
+      showQRCode: false, // 是否显示二维码
+      errorMessage: '', // 错误信息
+    };
+  },
+  methods: {
+    async login() {
+      try {
+        const response = await getDeviceIdByAccount(this.account);
+        this.deviceId = response.deviceId;
+        this.showQRCode = !!this.deviceId; // 根据 deviceId 控制是否显示二维码
+        if (this.showQRCode) {
+          // 获取二维码
+          this.getQRCode();
+        } else {
+          // deviceId 为空时显示错误提示
+          this.errorMessage = '请检查账号是否正确或是否审核通过';
+        }
+      } catch (error) {
+        // 处理错误
+        console.error(error);
+      }
+    },
+    async getQRCode() {
+      this.loading = true;
+      try {
+        const response = await getQrCode();
+        this.generateQRCode(response.qrCode);
+      } catch (error) {
+        // 处理错误
+        console.error(error);
+      }
+      this.loading = false;
+    },
+    generateQRCode(base64String) {
+      // 渲染二维码
+      if (this.qrcode) {
+        this.qrcode.clear();
+      }
+      this.qrcode = new QRCode(this.$refs.qrcodeContainer, {
+        text: base64String,
+        width: 180,
+        height: 180,
+      });
+    },
+  },
+};
+</script>
+
+<style scoped>
+.scan-login {
+  height: 100vh;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.scan-card {
+  width: 400px;
+}
+
+.scan-card-content {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  padding: 20px;
+}
+
+.title {
+  font-size: 24px;
+  margin-bottom: 20px;
+}
+
+.qrcode-container {
+  position: relative;
+  text-align: center;
+}
+
+.qrcode {
+  display: inline-block;
+  margin-bottom: 10px;
+}
+
+.qrcode-refresh {
+  position: absolute;
+  bottom: 0;
+  left: 50%;
+  transform: translateX(-50%);
+  display: flex;
+  align-items: center;
+  cursor: pointer;
+  color: #1890ff;
+}
+
+.qrcode-refresh i {
+  margin-right: 5px;
+}
+
+.qrcode-refresh:hover {
+  color: #40a9ff;
+}
+</style>

+ 66 - 5
src/views/store/components/productOrder.vue

@@ -17,11 +17,12 @@
         </span>
         </span>
        
        
         <div class="operate-button-container" >
         <div class="operate-button-container" >
+          <el-button size="mini" @click="handleCertificates()"  v-hasPermi="['store:storeOrder:uploadCredentials']" >上传凭证</el-button>
           <el-button size="mini" @click="handleEditAddress()" v-if="order.status==0||order.status==1"  v-hasPermi="['store:storeOrder:editAddress']" >修改收货地址</el-button>
           <el-button size="mini" @click="handleEditAddress()" v-if="order.status==0||order.status==1"  v-hasPermi="['store:storeOrder:editAddress']" >修改收货地址</el-button>
           <el-button size="mini" @click="handleBindCustomer()"  v-hasPermi="['store:storeOrder:bindCustomer']" >关联客户</el-button>
           <el-button size="mini" @click="handleBindCustomer()"  v-hasPermi="['store:storeOrder:bindCustomer']" >关联客户</el-button>
           <el-button size="mini" @click="editOrder()"  v-hasPermi="['store:storeOrder:edit']" >修改订单</el-button>
           <el-button size="mini" @click="editOrder()"  v-hasPermi="['store:storeOrder:edit']" >修改订单</el-button>
           <!-- <el-button size="mini" @click="handleEditUser()"  v-hasPermi="['users:user:edit']" >修改会员修改</el-button> -->
           <!-- <el-button size="mini" @click="handleEditUser()"  v-hasPermi="['users:user:edit']" >修改会员修改</el-button> -->
-          <el-button size="mini" v-if="order.customerId!=null&&order.customerId>0"  @click="handleCustomer()"    >查看客户详情</el-button>
+          <el-button size="mini" v-if="order.customerId!=null&&order.customerId>0"  @click="handleCustomer()"    >查看客户详情</el-button>         
         </div>
         </div>
         <div class="operate-button-container"  v-hasPermi="['store:storeOrder:express']"  >
         <div class="operate-button-container"  v-hasPermi="['store:storeOrder:express']"  >
           <el-button size="mini" @click="showExpress()" >查看物流</el-button>
           <el-button size="mini" @click="showExpress()" >查看物流</el-button>
@@ -124,6 +125,21 @@
             </el-descriptions-item>
             </el-descriptions-item>
         
         
       </el-descriptions>
       </el-descriptions>
+      <div style="margin: 20px 0px"  v-if="order!=null">
+        <span class="font-small">
+          凭证信息
+        </span>
+      </div>
+      <el-image
+          v-if="certificates != ''"
+          :src="certificates"
+          :preview-src-list="[certificates]"
+          :style="{ width: '100px', height: '100px' }"
+          @click.native="showImageDialog"
+        ></el-image>
+        <el-dialog :visible.sync="dialogVisibleImage" width="10%">
+          <img :src="certificates" style="width: 100%" alt="">
+        </el-dialog>
 
 
       <div style="margin-top: 20px">
       <div style="margin-top: 20px">
         <span class="font-small">商品信息</span>
         <span class="font-small">商品信息</span>
@@ -399,6 +415,16 @@
         <el-button type="primary" @click="submitBindCustomerForm">确 定</el-button>
         <el-button type="primary" @click="submitBindCustomerForm">确 定</el-button>
       </div>
       </div>
     </el-dialog>
     </el-dialog>
+    <el-dialog :title="certificateDialig.title" :visible.sync="certificateDialig.open" append-to-body>
+      <el-form ref="certificateForm" :model="certificateForm" :rules="certificateRules" label-width="100px">
+        <el-form-item label="凭证" prop="certificates">
+          <ImageUpload v-model="photoArr" type="image" :num="10" :width="150" :height="150" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="handleConfirm">确 定</el-button>
+      </div>
+    </el-dialog>
     <el-drawer
     <el-drawer
       :append-to-body="true"
       :append-to-body="true"
       size="75%"
       size="75%"
@@ -413,20 +439,35 @@
 import {updateUser,getUser } from "@/api/users/user";
 import {updateUser,getUser } from "@/api/users/user";
 
 
 import {getCustomerListBySearch } from "@/api/crm/customer";
 import {getCustomerListBySearch } from "@/api/crm/customer";
-
-import {bindCustomer,getExpress, listStoreOrder, getStoreOrder, delStoreOrder, addStoreOrder, updateStoreOrder, exportStoreOrder } from "@/api/store/storeOrder";
+import ImageUpload from '@/components/ImageUpload'
+import {bindCustomer,getExpress, listStoreOrder, getStoreOrder, delStoreOrder, addStoreOrder, updateStoreOrder, exportStoreOrder,uploadCredentials } from "@/api/store/storeOrder";
 import {getAllList} from "@/api/store/city";
 import {getAllList} from "@/api/store/city";
 import customerDetails from '../../crm/components/customerDetails.vue';
 import customerDetails from '../../crm/components/customerDetails.vue';
 export default {
 export default {
   name: "order",
   name: "order",
-  components: {customerDetails },
+  components: {customerDetails, 
+    ImageUpload },
   data() {
   data() {
     return {
     return {
+      dialogVisibleImage: false,
       customerInfo:null,
       customerInfo:null,
       customer:{
       customer:{
         title:"客户详情",
         title:"客户详情",
         open:false,
         open:false,
       },
       },
+      photoArr:'',
+      certificateDialig:{
+        title:"上传凭证",
+        open:false,
+      },
+      certificateForm:{
+        certificates:null,
+      },
+      certificateRules:{
+        certificates:[
+          { required: true, message: "凭证不能为空", trigger: "change" }
+        ]
+      },
       customers:[],
       customers:[],
       bindCustomerDialog:{
       bindCustomerDialog:{
         title:"关联客户",
         title:"关联客户",
@@ -489,6 +530,7 @@ export default {
       orderTypeOptions:[],
       orderTypeOptions:[],
       payTypeOptions:[],
       payTypeOptions:[],
       statusOptions:[],
       statusOptions:[],
+      certificates:'',
       order:null,
       order:null,
       user:{},
       user:{},
       logs:[],
       logs:[],
@@ -514,6 +556,9 @@ export default {
    
    
   },
   },
   methods: {
   methods: {
+    showImageDialog() {
+      this.dialogVisible = true;
+    },
     handleCustomer(){
     handleCustomer(){
       var that=this;
       var that=this;
       this.customer.open = true;
       this.customer.open = true;
@@ -554,6 +599,20 @@ export default {
         }
         }
       });
       });
     },
     },
+    handleCertificates(){
+      this.certificateDialig.open = true;
+    },
+    handleConfirm(){
+      this.certificateForm.id = this.orderId;
+      this.certificateForm.certificates = this.photoArr;
+      uploadCredentials(this.certificateForm).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("上传成功");
+                this.certificateDialig.open = false;
+                this.getOrder(this.order.id);
+              }
+            });
+    },
     showExpress(){
     showExpress(){
       this.expressDialog.open=true;
       this.expressDialog.open=true;
       getExpress(this.orderId).then(response => {
       getExpress(this.orderId).then(response => {
@@ -694,12 +753,14 @@ export default {
         this.orderId=orderId;
         this.orderId=orderId;
         getStoreOrder(orderId).then(response => {
         getStoreOrder(orderId).then(response => {
             this.order = response.order;
             this.order = response.order;
+            if(response.order.certificates != null){
+              this.certificates = response.order.certificates;
+            }  
             this.user = response.user;
             this.user = response.user;
             this.logs = response.logs;
             this.logs = response.logs;
             this.items = response.items;
             this.items = response.items;
             this.payments=response.payments;
             this.payments=response.payments;
             this.customerInfo=response.customer;
             this.customerInfo=response.customer;
-            
         });
         });
      }
      }
   }
   }