Browse Source

完成清单与其它部分

wolyshaw 4 years ago
parent
commit
5421e661d9

+ 14 - 1
src/api/orderManager.js

@@ -1,5 +1,7 @@
 // 系统专项设置api文件
 import request from '@/utils/request'
+import request2 from '@/utils/request2'
+
 import qs from 'qs'
 let api = '/api-web'
 // 订单列表
@@ -185,6 +187,17 @@ export function updateSellOrder (data) {
     params: data
   })
 }
+
+// 销售列表退费
+export function refundSellOrder (data) {
+  return request2({
+    url: api + '/sellOrder/refund',
+    method: 'POST',
+    params: data,
+    hint: true
+  })
+}
+
 // 获取订单详情
 export function getOrderInfo (data) {
   return request({
@@ -201,4 +214,4 @@ export function orderDelete (data) {
     method: 'POST',
     data: qs.stringify(data)
   })
-}
+}

+ 171 - 0
src/utils/request2.js

@@ -0,0 +1,171 @@
+import ElementUI from 'element-ui'
+import axios from 'axios'
+import { Message } from 'element-ui'
+import store from '@/store'
+import { getToken } from '@/utils/auth'
+import cleanDeep from 'clean-deep'
+// import { Loading } from 'element-ui'
+import load from '@/utils/loading'
+import router from '@/router/index'
+import Vue from 'vue'
+const showMessage = Symbol('showMessage')
+class DonMessage {
+  success (options, single = true) {
+    this[showMessage]('success', options, single)
+  }
+  warning (options, single = true) {
+    this[showMessage]('warning', options, single)
+  }
+  info (options, single = true) {
+    this[showMessage]('info', options, single)
+  }
+  error (options, single = true) {
+    this[showMessage]('error', options, single)
+  }
+  [showMessage] (type, options, single) {
+    if (single) {
+      // 判断是否已存在Message
+      if (document.getElementsByClassName('el-message').length === 0) {
+        Message[type](options)
+      }
+    } else {
+      Message[type](options)
+    }
+  }
+}
+
+Vue.use(ElementUI)
+// 命名根据需要,DonMessage只是在文章中使用
+Vue.prototype.$message = new DonMessage()
+
+let vue = new Vue()
+
+// let loading        //定义loading变量
+
+// function startLoading () {    //使用Element loading-start 方法
+//   loading = Loading.service({
+//     lock: true,
+//     fullscreen: true,
+//     text: '加载中……',
+//     background: 'rgba(0, 0, 0, 0.7)'
+//   })
+// }
+// function endLoading () {
+//   //使用Element loading-close 方法
+//   loading.close();
+// }
+//那么 showFullScreenLoading() tryHideFullScreenLoading() 要干的事儿就是将同一时刻的请求合并。
+//声明一个变量 needLoadingRequestCount,每次调用showFullScreenLoading方法 needLoadingRequestCount + 1。
+//调用tryHideFullScreenLoading()方法,needLoadingRequestCount - 1。needLoadingRequestCount为 0 时,结束 loading。
+let needLoadingRequestCount = 0
+function showFullScreenLoading () {
+  if (needLoadingRequestCount === 0) {
+    load.startLoading()
+  }
+  needLoadingRequestCount++
+
+}
+
+function tryHideFullScreenLoading () {
+  if (needLoadingRequestCount <= 0) return
+  needLoadingRequestCount--
+  if (needLoadingRequestCount === 0) {
+    load.endLoading();
+
+  }
+
+}
+
+// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
+
+
+// create an axios instance
+const service = axios.create({
+  baseURL: '', // url = base url + request url
+  // withCredentials: true, // send cookies when cross-domain requests
+  timeout: 180000, // request timeout
+})
+// { fullscreen: true, text: '努力加载中', spinner: 'el-icon-loading' }
+// request interceptor
+service.interceptors.request.use(
+  config => {
+    // do something before request is sent
+    showFullScreenLoading()
+    if (store.getters.token) {
+      // let each request carry token
+      // ['X-Token'] is a custom headers key
+      // please modify it according to the actual situation
+      config.headers['Authorization'] = getToken()
+      // config.headers['content-type'] = "application/x-www-form-urlencoded"
+    }
+    config.params = cleanDeep(config.params)
+    //  params: cleanDeep(options.params),
+    return config
+  },
+  error => {
+    // do something with request error
+    tryHideFullScreenLoading()
+    return Promise.reject(error)
+
+  }
+)
+
+// response interceptor
+service.interceptors.response.use(
+  res => {
+    //res.code !== 200
+    if (res.data) {
+      let data = JSON.parse(JSON.stringify(res.data))
+      // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
+      if (data.code == 401 || data.code == 403) {
+        // Message({
+        //   message: `登录过期,请重新登录!`,
+        //   type: 'error',
+        //   duration: 5 * 1000
+        // })
+        vue.$message.error(`登录过期,请重新登录!`)
+        setTimeout(() => {
+          tryHideFullScreenLoading()
+          store.dispatch('user/resetToken').then(() => {
+            location.reload()
+          })
+        }, 1000);
+        return;
+      }
+      if (data.code == 404) {
+        router.push('/404')
+      }
+      if (data.code != 200) {
+        // Message({
+        //   message: data.msg || `请求失败code码为${ data.code }`,
+        //   type: 'error',
+        //   duration: 5 * 1000
+        // })
+        let str = data.msg || `请求失败code码为${data.code}`
+        if (res.config.hint !== true) {
+          vue.$message.error(str)
+        }
+        tryHideFullScreenLoading()
+        return Promise.reject(data)
+      } else {
+        tryHideFullScreenLoading()
+        return data
+
+      }
+    } else {
+
+      tryHideFullScreenLoading()
+      return Promise.reject()
+    }
+  },
+  error => {
+    if (error.message == 'Network Error') {
+      vue.$message.error('网络异常,请检查网络连接')
+    } else {
+      vue.$message.error(error.message)
+    }
+    tryHideFullScreenLoading()
+    return Promise.reject(error)
+  }
+)
+export default service

+ 9 - 0
src/utils/vueFilter.js

@@ -403,6 +403,15 @@ Vue.filter('vipCourseStatus', value => {
   return template[value]
 })
 
+// 账号类型
+Vue.filter('accountTypeFormat', value => {
+  let template = {
+    INTERNAL: "对内",
+    EXTERNAL: "对外",
+  }
+  return template[value]
+})
+
 // 交易状态
 Vue.filter('paymentChannelStatus', value => {
   let template = {

+ 30 - 4
src/views/businessManager/orderManager/salesList.vue

@@ -161,9 +161,13 @@
               <el-button @click="onBackMoney(scope.row)"
                          v-permission="'sellOrder/update'"
                          type="text">修改成本</el-button>
-              <el-button @click="openRefund(scope.row)"
-                         v-permission="'sellOrder/update'"
-                         type="text">退费</el-button>
+              <el-popconfirm title="是否确定退?"
+                             @onConfirm="() => refund({id: scope.row.id})"
+                             v-if="scope.row.status === 0"
+                             v-permission="'sellOrder/refund'">
+                <el-button type="text"
+                           slot="reference">退费</el-button>
+              </el-popconfirm>
             </template>
           </el-table-column>
         </el-table>
@@ -279,7 +283,7 @@
 </template>
 <script>
 import pagination from '@/components/Pagination/index'
-import { getSellOrder, updateSellOrder } from '@/api/orderManager'
+import { getSellOrder, updateSellOrder, refundSellOrder } from '@/api/orderManager'
 import { getEmployeeOrgan, getCooperation, findEducationUsers } from '@/api/buildTeam'
 import { paymentChannelStatus } from '@/utils/searchArray'
 import dayjs from 'dayjs'
@@ -428,6 +432,28 @@ export default {
     onFormClose (formName) { // 关闭弹窗重置验证
       this.$refs[formName].clearValidate()
     },
+    refund(data) {
+      refundSellOrder(data)
+        .then(res => {
+          this.getList()
+          this.$message.success('退费成功')
+        })
+        .catch(res => {
+          if (res.code === 100) {
+            this.$confirm(res.msg, '提示', {
+              confirmButtonText: '确定',
+              cancelButtonText: '取消',
+              type: 'warning'
+            })
+            .then(() => {
+              this.refund({
+                ...data,
+                reTry: true
+              })
+            })
+          }
+        })
+    },
     openRefund(row) {
       this.refundVisible = true
       this.detail = row

+ 16 - 1
src/views/chargeManager/one.vue

@@ -9,6 +9,9 @@
           <el-table-column align="center" label="收款方式">
             <template slot-scope="scope">{{ scope.row.payType | paymentChannelStatus }}</template>
           </el-table-column>
+          <el-table-column align="center" label="账户类型">
+            <template slot-scope="scope">{{ scope.row.accountType | accountTypeFormat }}</template>
+          </el-table-column>
           <el-table-column align="center" prop="hfMerNo" label="汇付商户号"></el-table-column>
           <el-table-column align="center" prop="yqMerNo" label="双乾商户号"></el-table-column>
           <el-table-column align="center" label="收款比例">
@@ -65,6 +68,12 @@
             <el-option value="YQPAY" label="双乾"></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="账户类型" prop="accountType" :label-width="formLabelWidth">
+          <el-select v-model.trim="form.accountType" placeholder="请选择账户类型">
+            <el-option value="INTERNAL" label="对内"></el-option>
+            <el-option value="EXTERNAL" label="对外"></el-option>
+          </el-select>
+        </el-form-item>
         <!-- prop="yqMerNo" :error="result.yqError" -->
         <el-form-item
           label="双乾商户号"
@@ -208,6 +217,7 @@ export default {
         hfMerNo: null,
         yqMerNo: null,
         payType: null, // 支付渠道
+        accountType: null,
         type: 2,
         routeScale: []
       },
@@ -223,6 +233,9 @@ export default {
         ],
         payType: [
           { required: true, message: "请选择收款方式", trigger: "change" }
+        ],
+        accountType: [
+          { required: true, message: "请选择账户类型", trigger: "change" }
         ]
       },
       result: {
@@ -524,6 +537,7 @@ export default {
           id: data.id,
           type: Number(data.type),
           hfMerNo: data.hfMerNo,
+          accountType: data.accountType,
           yqMerNo: data.yqMerNo,
           payType: data.payType,
           organId: data.organId
@@ -568,6 +582,7 @@ export default {
         organId: null,
         hfMerNo: null,
         yqMerNo: null,
+        accountType: null,
         payType: null, // 支付渠道
         type: 2,
         routeScale: []
@@ -659,4 +674,4 @@ export default {
   width: 150px;
   text-align: center;
 }
-</style>
+</style>

+ 2 - 2
vue.config.js

@@ -18,10 +18,10 @@ const name = defaultSettings.title || '管乐迷后台管理系统' // page titl
 // //  https://online.dayaedu.com
 // let target = 'https://online.dayaedu.com' //线上
 // let target = 'http://dyme.utools.club' //test环境
-// let target = 'http://192.168.3.139:8000' // 箭河
+let target = 'http://192.168.3.139:8000' // 箭河
 // let target = 'http://192.168.3.28:8000' //邹璇
 // let target = 'http://192.168.3.8:8000' //勇哥
-let target = 'http://dev.dayaedu.com' // 测试服
+// let target = 'http://dev.dayaedu.com' // 测试服
 // let target = 'http://192.168.3.196:8080' // 乔
 // All configuration item explanations can be find in https://cli.vuejs.org/config/
 module.exports = {

+ 0 - 0
{