Browse Source

Merge branch 'master' of http://159.75.201.17:3000/zwq/tuanfeng-pc-admin

wzy 6 months ago
parent
commit
875493d86f

+ 1 - 0
.env.development

@@ -7,6 +7,7 @@ VUE_APP_BASE_API = '/dev-api'
 # 开发环境
 # VUE_APP_DOMAIN_PREFIX = 'http://192.168.0.91:9003'
 # 线上
+VUE_APP_DOMAIN_TF = 'https://nsappapi.tuanfengkeji.cn'
 VUE_APP_DOMAIN_TUAN = 'https://www.tuanfengkeji.cn/dts-app-api'
 VUE_APP_DOMAIN_PREFIX = 'https://nsadminapi.tuanfengkeji.cn'
 # 演示环境

+ 1 - 0
.env.production

@@ -4,5 +4,6 @@ ENV = 'production'
 # base api
 VUE_APP_BASE_API = '/prod-api'
 
+VUE_APP_DOMAIN_TF = 'https://nsappapi.tuanfengkeji.cn'
 VUE_APP_DOMAIN_TUAN = 'https://www.tuanfengkeji.cn/dts-app-api'
 VUE_APP_DOMAIN_PREFIX = 'https://nsadminapi.tuanfengkeji.cn'

+ 1 - 0
.env.staging

@@ -9,5 +9,6 @@ VUE_APP_BASE_API = '/stage-api'
 # 线上
 # VUE_APP_DOMAIN_PREFIX = 'https://nsadminapi.tuanfengkeji.cn'
 # 测试
+VUE_APP_DOMAIN_TF = 'https://nsappapitest.tuanfengkeji.cn'
 VUE_APP_DOMAIN_TUAN = 'https://test.tuanfengkeji.cn/dts-app-api'
 VUE_APP_DOMAIN_PREFIX = 'https://nsadminapitest.tuanfengkeji.cn'

+ 10 - 0
src/api/order.js

@@ -1,4 +1,5 @@
 import request from '@/utils/request'
+import aTFRequest from '@/utils/aTFRequest'
 
 //* ******************** 待处理订单  *********************
 // 订单管理查询
@@ -62,4 +63,13 @@ export function halfOrderRe(id){
     url:"/order/reSubmitBanziOrder/"+id,
     method: 'put',
   })
+}
+
+// 三方已支付时更新本系统的订单支付状态
+export function syncLocalOrderStatusPaid(params) {
+  return aTFRequest({
+    url: '/order/syncLocalOrderStatusWhen3rdPaid',
+    method: 'get',
+    params
+  })
 }

+ 88 - 0
src/utils/aTFRequest.js

@@ -0,0 +1,88 @@
+import Vue from 'vue'
+import axios from 'axios'
+import {
+  MessageBox,
+  Message
+} from 'element-ui'
+import store from '@/store'
+import router from '@/router'
+import {
+  getToken, removeToken
+} from '@/utils/auth'
+
+const baseURL = process.env.VUE_APP_DOMAIN_TF
+// create an axios instance
+Vue.prototype.axios = axios
+axios.defaults.timeout = 30000
+const service = axios.create({
+  baseURL, // url = base url + request url
+  // withCredentials: true, // send cookies when cross-domain requests
+  timeout: 30000 // request timeout
+})
+
+export const token = getToken()
+
+// request interceptor
+service.interceptors.request.use(
+  (config) => {
+    // console.log(config)
+    if (store.getters.token) {
+      config.headers['Content-Type'] = 'application/json'
+      config.headers.Authorization = getToken()
+      config.headers['satoken-user'] = getToken()
+    }
+    return config
+  },
+  (error) => {
+    console.log(error) // for debug
+    return Promise.reject(error)
+  }
+)
+
+// response interceptor
+// eslint-disable-next-line complexity
+service.interceptors.response.use((response) => {
+  if (response.statusCode == 200) {
+    if ((response.data.code === '200') || (response.data.code === '')) {
+      return response.data
+    } else if ((response.data.code === '20004') || (response.data.code === '20005') || (response.data.code == 40005)) { // 有res.data
+      MessageBox.confirm(
+        'You have been logged out, you can cancel to stay on this page, or log in again',
+        'Confirm logout',
+        {
+          confirmButtonText: 'Re-Login',
+          cancelButtonText: 'Cancel',
+          type: 'warning'
+        }
+      ).then(() => {
+        store.dispatch('user/resetToken').then(() => {
+          location.reload()
+        })
+      })
+      return Promise.reject(new Error(response.data.message || 'Error'))
+    }  // 有res.data
+    Message({
+      message: response.data.message || 'Error',
+      type: 'error',
+      duration: 5 * 1000
+    })
+    return Promise.reject(response)
+  }  // 没有res.data
+  Message({
+    message: `请求错误:${response.errMsg}`,
+    type: 'error',
+    duration: 5 * 1000
+  })
+  console.log('请求错误', response)
+  return Promise.reject(response)
+}, (error) => {
+  Message({
+    message: `请求失败:${error.errMsg}`,
+    type: 'error',
+    duration: 5 * 1000
+  })
+  console.log('请求失败', error)
+  return Promise.reject(error)
+})
+
+export default service

+ 151 - 0
src/views/order/pending/components/PaymentStatusUpdate.vue

@@ -0,0 +1,151 @@
+<template>
+  <el-dialog
+    :visible.sync="visible"
+    v-bind="modalOptions"
+    append-to-body
+    @close="handleClose"
+  >
+    <el-form
+      ref="formData"
+      :model="formData"
+      :rules="formRules"
+      size="mini"
+      label-suffix=":"
+      label-width="150px"
+    >
+      <el-form-item label="客户方子订单编号" prop="orderFormId">
+        <el-input
+          v-model="formData.orderFormId" maxlength="20" placeholder="客户方子订单编号" disabled
+        />
+      </el-form-item>
+      <el-form-item label="号码类型" prop="numberType">
+        <el-radio-group
+          v-model="formData.numberType"
+          @input="(e) => e === 1 ? (formData.transactionId = '') : e === 2 ? (formData.outTradeNO = '') : ''"
+        >
+          <el-radio :label="1">客户方支付主订单编号</el-radio>
+          <el-radio :label="2">三方流水号</el-radio>
+        </el-radio-group>
+      </el-form-item>
+      <el-form-item v-if="formData.numberType === 1" label="客户方支付主订单编号" prop="outTradeNO">
+        <el-input v-model="formData.outTradeNO" placeholder="请输入客户方支付主订单编号" />
+      </el-form-item>
+      <el-form-item v-else-if="formData.numberType === 2" label="三方流水号" prop="transactionId">
+        <el-input v-model="formData.transactionId" placeholder="请输入三方流水号" />
+      </el-form-item>
+      <el-form-item label="支付方式" prop="paymentMode">
+        <el-select
+          v-model="formData.paymentMode" size="mini"
+          style="width: 240px;" placeholder="请选择支付方式(三方流水号共存)"
+        >
+          <el-option label="惠市宝" :value="9" />
+          <el-option label="通联" :value="4" />
+        </el-select>
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <span class="dialog-footer">
+        <el-button size="mini" @click="handleClose">取 消</el-button>
+        <el-button type="primary" size="mini" @click="handleSubmit">确 定</el-button>
+      </span>
+    </template>
+  </el-dialog>
+</template>
+
+<script>
+import { syncLocalOrderStatusPaid } from '@/api/order'
+
+export default {
+  name: 'PaymentStatusUpdate',
+  components: {
+  },
+  data() {
+    return {
+      modalOptions: {
+        closeOnClickModal: false,
+        width: '620px',
+        title: ''
+      },
+      visible: false,
+      formData: {
+        orderFormId: '',
+        numberType: 2, // 后端无需
+        outTradeNO: '',
+        transactionId: '',
+        paymentMode: ''
+      },
+      formRules: {
+        orderFormId: [
+          { required: true, message: '缺少客户方子订单编号' }
+        ],
+        numberType: [
+          { required: true, message: '缺少号码类型' }
+        ],
+        outTradeNO: [],
+        transactionId: [
+          { required: true, message: '请输入三方流水号' }
+        ]
+      }
+    }
+  },
+  watch: {
+    'formData.numberType': {
+      deep: true,
+      handler(val) {
+        if (val === 1) {
+          this.formRules.outTradeNO = [
+            { required: true, message: '请输入客户方支付主订单编号' }
+          ]
+          this.formRules.transactionId = []
+        } else if (val === 2) {
+          this.formRules.outTradeNO = []
+          this.formRules.transactionId = [
+            { required: true, message: '请输入三方流水号' }
+          ]
+        }
+      }
+    }
+  },
+  methods: {
+    handleClose() {
+      this.visible = false
+    },
+    initList() {
+    },
+    handleOpen(params = {}) {
+      this.modalOptions.title = '同步支付状态'
+      this.$refs.formData && this.$refs.formData.resetFields()
+      this.formData.orderFormId = params.orderFormid
+      // this.formData = Object.assign(this.$options.data().formData, params)
+      this.visible = true
+      this.initList()
+    },
+    handleSubmit() {
+      this.$refs.formData.validate(async (valid) => {
+        if (valid) {
+          const loading = this.$loading({ text: '加载中' })
+          try {
+            const { ...otps } = this.formData
+            const params = {
+              ...otps
+            }
+            await syncLocalOrderStatusPaid(params)
+            loading.close()
+            this.$message({ message: `操作成功!`, type: 'success' })
+            this.$emit('success')
+            this.visible = false
+          } catch (e) {
+            loading.close()
+          } finally {
+            loading.close()
+          }
+        } else {
+          this.$message({ message: '请输入相关信息', type: 'warning' })
+          return false
+        }
+      })
+    }
+  }
+}
+</script>
+

+ 12 - 2
src/views/order/pending/index.vue

@@ -127,11 +127,17 @@
         </el-table-column>
         <el-table-column align="center" label="收件人" prop="receiveName" show-overflow-tooltip />
         <el-table-column align="center" label="手机号" prop="receivePhone" show-overflow-tooltip />
-        <el-table-column align="center" label="操作" width="120" fixed="right" class-name="small-padding fixed-width">
+        <el-table-column align="center" label="操作" width="180" fixed="right" class-name="small-padding fixed-width">
           <template slot-scope="{ row }">
             <el-button type="warning" size="mini" @click="handleDetail(row)">
               详情
             </el-button>
+            <el-button
+              v-if="row.state === 1" type="danger" size="mini"
+              @click="$refs.PaymentStatusUpdate && $refs.PaymentStatusUpdate.handleOpen(row)"
+            >
+              同步支付状态
+            </el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -149,6 +155,8 @@
     <el-dialog title="订单详情" :visible.sync="detailVisible" width="74%" center :close-on-click-modal="false">
       <OrderDetail :detail-row="form" @cancel="detailVisible = false" />
     </el-dialog>
+    <!-- 同步支付状态 -->
+    <PaymentStatusUpdate ref="PaymentStatusUpdate" @success="getList" />
 
     <el-dialog title="选择导出模版" :visible.sync="exportExcelVisible" center :close-on-click-modal="false">
       <el-radio-group v-model="exportTemplate">
@@ -170,11 +178,13 @@
 
 <script>
 import OrderDetail from './components/pendDetails'
+import PaymentStatusUpdate from './components/PaymentStatusUpdate'
 import { orderGetAll, orderExport } from '@/api/order'
 export default {
   name: 'Pending',
   components: {
-    OrderDetail
+    OrderDetail,
+    PaymentStatusUpdate
   },
   data() {
     return {

+ 4 - 4
src/views/renovation/commoditySystem/components/ProductReview.vue

@@ -3,7 +3,7 @@
     :visible.sync="visible"
     v-bind="modalOptions"
     append-to-body
-    @close="diaClose""
+    @close="handleClose"
   >
     <el-form
       ref="formData"
@@ -93,11 +93,11 @@ export default {
       //  重置表单
       this.$refs.formData && this.$refs.formData.resetFields()
       this.formData.productId = params.productId
-      console.log(params.productId,this.formData.productId);
+      console.log(params.productId, this.formData.productId)
       // this.formData = Object.assign(this.$options.data().formData, params)
       this.visible = true
       // this.initList()
-      // this.$refs.formData && 
+      // this.$refs.formData &&
     },
     handleSubmit() {
       this.$refs.formData.validate(async (valid) => {
@@ -129,7 +129,7 @@ export default {
       })
     },
     //  关闭弹框 重置 id
-    diaClose(){
+    diaClose() {
       // this.formData.productId = ''
     }
   }