Browse Source

修改 bug

develop
王泽彦 5 months ago
parent
commit
ca0fe0797c
  1. 22
      admin/src/app/views/campus_person_role/components/campus-person-role-edit.vue
  2. 26
      admin/src/app/views/personnel/components/personnel-edit.vue
  3. 2
      niucloud/app/adminapi/controller/pay/Pay.php
  4. 6
      niucloud/app/api/controller/apiController/OrderTable.php
  5. 2
      niucloud/app/api/controller/pay/Pay.php
  6. 12
      niucloud/app/model/personnel/Personnel.php
  7. 6
      niucloud/app/service/admin/pay/PayService.php
  8. 8
      niucloud/app/service/admin/personnel/PersonnelService.php
  9. 8
      niucloud/core/pay/Wechatpay.php
  10. 2
      uniapp/components/order-list-card/index.vue

22
admin/src/app/views/campus_person_role/components/campus-person-role-edit.vue

@ -212,8 +212,12 @@ const setCampusIdList = async () => {
} }
setCampusIdList() setCampusIdList()
const personIdList = ref([] as any[]) const personIdList = ref([] as any[])
const setPersonIdList = async () => { const setPersonIdList = async (campus_id?: string | number) => {
personIdList.value = await (await getWithPersonnelList({})).data const params: Record<string, any> = {}
if (campus_id) {
params.campus_id = campus_id
}
personIdList.value = await (await getWithPersonnelList(params)).data
} }
setPersonIdList() setPersonIdList()
const roleIdList = ref([] as any[]) const roleIdList = ref([] as any[])
@ -300,6 +304,20 @@ const numberVerify = (rule: any, value: any, callback: any) => {
} }
} }
// ,
watch(() => formData.campus_id, async (newCampusId) => {
if (newCampusId) {
//
formData.person_id = ''
//
await setPersonIdList(newCampusId)
} else {
// ,
formData.person_id = ''
await setPersonIdList()
}
})
defineExpose({ defineExpose({
showDialog, showDialog,
setFormData, setFormData,

26
admin/src/app/views/personnel/components/personnel-edit.vue

@ -82,8 +82,15 @@
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="所属校区" prop="campus_id">
<el-select class="input-width" v-model="formData.campus_id" clearable placeholder="请选择所属校区">
<el-option label="请选择" value=""></el-option>
<el-option v-for="item in campusList" :key="item.id" :label="item.campus_name" :value="item.id" />
</el-select>
</el-form-item>
</el-form> </el-form>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="详情信息" name="info"> <el-tab-pane label="详情信息" name="info">
@ -378,7 +385,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, computed, watch } from 'vue' import { ref, reactive, computed, watch, onMounted } from 'vue'
import { useDictionary } from '@/app/api/dict' import { useDictionary } from '@/app/api/dict'
import { t } from '@/lang' import { t } from '@/lang'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
@ -387,6 +394,7 @@
editPersonnel, editPersonnel,
getPersonnelInfo, getPersonnelInfo,
} from '@/app/api/personnel' } from '@/app/api/personnel'
import { getWithCampusList } from '@/app/api/campus_person_role'
let showDialog = ref(false) let showDialog = ref(false)
const loading = ref(false) const loading = ref(false)
@ -409,6 +417,7 @@
id_card_back: '', id_card_back: '',
status: '', status: '',
is_sys_user: '', is_sys_user: '',
campus_id: '',
info:{ info:{
name:'', name:'',
store:'', store:'',
@ -566,6 +575,19 @@
} }
) )
//
let campusList = ref([])
const getCampusList = async () => {
const res = await getWithCampusList({})
if (res.data) {
campusList.value = res.data
}
}
onMounted(() => {
getCampusList()
})
const setFormData = async (row : any = null) => { const setFormData = async (row : any = null) => {
Object.assign(formData, initialFormData) Object.assign(formData, initialFormData)
loading.value = true loading.value = true

2
niucloud/app/adminapi/controller/pay/Pay.php

@ -116,7 +116,7 @@ class Pay extends BaseAdminController
['order_id', ''], ['order_id', ''],
]); ]);
return success(data:(new PayService())->order_pay($data)); return success(data:(new PayService())->qr_order_pay($data));
} }
public function check_payment_status(){ public function check_payment_status(){

6
niucloud/app/api/controller/apiController/OrderTable.php

@ -212,12 +212,12 @@ class OrderTable extends BaseApiService
} }
// 查询订单状态 // 查询订单状态
$order = \app\model\order_table\OrderTable::where('payment_id', $order_no)->find(); $payorder = \app\model\pay\Pay::where('out_trade_no', $order_no)->find();
if (!$order) { if (!$payorder) {
return fail('订单不存在'); return fail('订单不存在');
} }
$order = \app\model\order_table\OrderTable::where('id', $payorder->trade_id)->find();
$orderData = $order->toArray(); $orderData = $order->toArray();
return success([ return success([

2
niucloud/app/api/controller/pay/Pay.php

@ -103,7 +103,7 @@ class Pay extends BaseApiController
$data = $this->request->params([ $data = $this->request->params([
['order_id', ''], ['order_id', ''],
]); ]);
return success('SUCCESS',(new \app\service\admin\pay\PayService())->order_pay($data)); return success('SUCCESS',(new \app\service\admin\pay\PayService())->qr_order_pay($data));
} }
public function qrcodeNotify(int $order_id) public function qrcodeNotify(int $order_id)

12
niucloud/app/model/personnel/Personnel.php

@ -181,7 +181,17 @@ class Personnel extends BaseModel
return $this->hasOne(\app\model\sys\SysUser::class, 'uid', 'sys_user_id'); return $this->hasOne(\app\model\sys\SysUser::class, 'uid', 'sys_user_id');
} }
/**
* 关联校区表
* @return HasOne
*/
public function campus()
{
return $this->hasOne(\app\model\campus\Campus::class, 'id', 'campus_id')
->joinType('left')
->withField('id,campus_name')
->bind(['campus_name']);
}
} }

6
niucloud/app/service/admin/pay/PayService.php

@ -225,7 +225,7 @@ class PayService extends BaseAdminService
return $pay_type_list; return $pay_type_list;
} }
public function order_pay($data) public function qr_order_pay($data)
{ {
$out_trade_no = 'sm' . date("YmdHis") . time(); $out_trade_no = 'sm' . date("YmdHis") . time();
$order = new OrderTable(); $order = new OrderTable();
@ -242,7 +242,7 @@ class PayService extends BaseAdminService
$pay = new PayLoader('Wechatpay', $config); $pay = new PayLoader('Wechatpay', $config);
$url = $pay->scan($params); $url = $pay->scan($params);
$path = qrcode($url['code_url'], '', [], 'upload/qrcode/pay/'); $path = qrcode($url['code_url'], '', [], 'upload/qrcode/pay');
$order->where(['id' => $data['order_id']])->update(['payment_id' => $out_trade_no,'ipv3' => $config['mch_secret_key']]); $order->where(['id' => $data['order_id']])->update(['payment_id' => $out_trade_no,'ipv3' => $config['mch_secret_key']]);
@ -273,7 +273,7 @@ class PayService extends BaseAdminService
$qrcode_content = file_get_contents($full_path); $qrcode_content = file_get_contents($full_path);
$qrcode_base64 = 'data:image/png;base64,' . base64_encode($qrcode_content); $qrcode_base64 = 'data:image/png;base64,' . base64_encode($qrcode_content);
} }
return [ return [
'qrcode_url' => getCurrentDomain() . $path, // 保留原URL 'qrcode_url' => getCurrentDomain() . $path, // 保留原URL
'qrcode_base64' => $qrcode_base64, // 新增base64字段 'qrcode_base64' => $qrcode_base64, // 新增base64字段

8
niucloud/app/service/admin/personnel/PersonnelService.php

@ -43,10 +43,10 @@ class PersonnelService extends BaseAdminService
*/ */
public function getPage(array $where = []) public function getPage(array $where = [])
{ {
$field = 'id,name,head_img,gender,birthday,phone,address,native_place,education,profile,emergency_contact_phone,id_card_front,id_card_back,employee_number,status,is_sys_user,sys_user_id,create_time,update_time,deleted_at'; $field = 'id,name,head_img,gender,birthday,phone,address,native_place,education,profile,emergency_contact_phone,id_card_front,id_card_back,employee_number,status,is_sys_user,sys_user_id,campus_id,create_time,update_time,deleted_at';
$order = 'create_time desc'; $order = 'create_time desc';
$search_model = $this->model->withSearch(["name", "gender", "phone", "address", "education", "employee_number", "status", "create_time"], $where)->field($field)->order($order); $search_model = $this->model->withSearch(["name", "gender", "phone", "address", "education", "employee_number", "status", "create_time"], $where)->with(['campus'])->field($field)->order($order);
$list = $this->pageQuery($search_model, function ($item) { $list = $this->pageQuery($search_model, function ($item) {
$CampusPersonRole = new CampusPersonRole(); $CampusPersonRole = new CampusPersonRole();
$item['is_role'] = 1; // 始终允许角色设置 $item['is_role'] = 1; // 始终允许角色设置
@ -82,9 +82,9 @@ class PersonnelService extends BaseAdminService
*/ */
public function getInfo(int $id) public function getInfo(int $id)
{ {
$field = 'id,name,gender,head_img,birthday,phone,address,native_place,education,profile,emergency_contact_phone,id_card_front,id_card_back,employee_number,status,is_sys_user,sys_user_id,create_time,update_time,deleted_at'; $field = 'id,name,gender,head_img,birthday,phone,address,native_place,education,profile,emergency_contact_phone,id_card_front,id_card_back,employee_number,status,is_sys_user,sys_user_id,campus_id,create_time,update_time,deleted_at';
$info = $this->model->field($field)->where([['id', "=", $id]])->findOrEmpty()->toArray(); $info = $this->model->with(['campus'])->field($field)->where([['id', "=", $id]])->findOrEmpty()->toArray();
$info['gender'] = strval($info['gender']); $info['gender'] = strval($info['gender']);
$info['status'] = strval($info['status']); $info['status'] = strval($info['status']);
$info['is_sys_user'] = strval($info['is_sys_user']); $info['is_sys_user'] = strval($info['is_sys_user']);

8
niucloud/core/pay/Wechatpay.php

@ -9,6 +9,7 @@ use app\dict\pay\TransferDict;
use core\exception\PayException; use core\exception\PayException;
use Psr\Http\Message\MessageInterface; use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use think\facade\Log;
use think\Response; use think\Response;
use Throwable; use Throwable;
use Yansongda\Artful\Exception\InvalidResponseException; use Yansongda\Artful\Exception\InvalidResponseException;
@ -211,10 +212,9 @@ class Wechatpay extends BasePay
], ],
])); ]));
} catch (\Exception $e) { } catch (\Exception $e) {
// if ($e instanceof InvalidResponseException) { if ($e instanceof InvalidResponseException) {
// throw new PayException($e->response->all()['message'] ?? ''); throw new PayException($e->response->all()['message'] ?? '');
// } }
dd($e);
throw new PayException($e->getMessage()); throw new PayException($e->getMessage());
} }
} }

2
uniapp/components/order-list-card/index.vue

@ -487,7 +487,7 @@ export default {
this.$refs.qrCodePopup.open() this.$refs.qrCodePopup.open()
// //
this.startPaymentPolling(order.order_no) this.startPaymentPolling(order.id)
} else { } else {
uni.showToast({ title: res.msg || '获取支付二维码失败', icon: 'none' }) uni.showToast({ title: res.msg || '获取支付二维码失败', icon: 'none' })
} }

Loading…
Cancel
Save