Browse Source

修改 bug

master
王泽彦 9 months ago
parent
commit
129fcb13f0
  1. 6
      niucloud/app/api/controller/pay/Pay.php
  2. 2
      niucloud/app/api/route/route.php
  3. 3
      niucloud/app/listener/personnel/Student.php
  4. 8
      niucloud/app/model/student_courses/StudentCourses.php
  5. 66
      niucloud/app/service/admin/pay/PayService.php
  6. 7
      uniapp/api/apiRoute.js
  7. 70
      uniapp/components/custom-modal/custom-modal.vue
  8. 234
      uniapp/components/custom-modal/example.vue
  9. 7
      uniapp/pages.json
  10. 120
      uniapp/pages/market/clue/clue_table.vue
  11. 737
      uniapp/pages/market/clue/order_list.vue

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

@ -101,11 +101,9 @@ class Pay extends BaseApiController
*/
public function getQrcode(){
$data = $this->request->params([
['trade_type', ''],
['trade_id', ''],
['type', ''],
['order_id', ''],
]);
return success('SUCCESS',(new PayService())->getQrcode($data['type'], $data['trade_type'], $data['trade_id']));
return success('SUCCESS',(new \app\service\admin\pay\PayService())->order_pay($data));
}
public function qrcodeNotify(int $order_id)

2
niucloud/app/api/route/route.php

@ -369,6 +369,8 @@ Route::group(function () {
Route::get('personnel/serviceLogDetail', 'apiController.Personnel/serviceLogDetail');
Route::post('personnel/updateServiceRemark', 'apiController.Personnel/updateServiceRemark');
Route::get('getQrcode', 'pay.Pay/getQrcode');
})->middleware(ApiChannel::class)
->middleware(ApiPersonnelCheckToken::class, true)

3
niucloud/app/listener/personnel/Student.php

@ -91,7 +91,8 @@ class Student
'gift_hours' => $course_info['gift_session_count'],
'start_date' => date("Y-m-d"),
'end_date' => date("Y-m-d", strtotime("+30 days")),
'single_session_count' => $course_info['single_session_count']
'single_session_count' => $course_info['single_session_count'],
'resource_id'=> $order_info['resource_id']
]);

8
niucloud/app/model/student_courses/StudentCourses.php

@ -69,18 +69,14 @@ class StudentCourses extends BaseModel
$query->where("course_id", $value);
}
}
public function student(){
return $this->hasOne(Student::class, 'id', 'student_id')->joinType('left')->withField('name,id')->bind(['student_id_name'=>'name']);
return $this->hasOne(Student::class, 'id', 'student_id');
}
public function course(){
return $this->hasOne(Course::class, 'id', 'course_id')->joinType('left')->withField('course_name,id')->bind(['course_id_name'=>'course_name']);
return $this->hasOne(Course::class, 'id', 'course_id');
}
}

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

@ -49,7 +49,7 @@ class PayService extends BaseAdminService
public function getAuditPage(array $where)
{
$field = 'id, out_trade_no, type, money, body, voucher, create_time, trade_id, trade_type, status';
$search_model = $this->model->where([ [ 'type', '=', PayDict::OFFLINEPAY ] ])->withSearch([ 'create_time', 'out_trade_no', 'status' ], $where)->field($field)->append([ 'type_name' ])->order('create_time desc');
$search_model = $this->model->where([['type', '=', PayDict::OFFLINEPAY]])->withSearch(['create_time', 'out_trade_no', 'status'], $where)->field($field)->append(['type_name'])->order('create_time desc');
return $this->pageQuery($search_model);
}
@ -61,9 +61,9 @@ class PayService extends BaseAdminService
public function getDetail(int $id)
{
$field = 'id,out_trade_no,trade_type,trade_id,trade_no,body,money,voucher,status,create_time,pay_time,cancel_time,type,channel,fail_reason';
return $this->model->where([ [ 'id', '=', $id ] ])
return $this->model->where([['id', '=', $id]])
->field($field)
->append([ 'type_name', 'channel_name', 'status_name' ])
->append(['type_name', 'channel_name', 'status_name'])
->findOrEmpty()
->toArray();
}
@ -75,7 +75,7 @@ class PayService extends BaseAdminService
*/
public function pass(string $out_trade_no)
{
return ( new CoreOfflineService() )->pass($out_trade_no);
return (new CoreOfflineService())->pass($out_trade_no);
}
/**
@ -85,7 +85,7 @@ class PayService extends BaseAdminService
*/
public function refuse(string $out_trade_no, string $reason)
{
return ( new CoreOfflineService() )->refuse($out_trade_no, $reason);
return (new CoreOfflineService())->refuse($out_trade_no, $reason);
}
/**
@ -114,7 +114,7 @@ class PayService extends BaseAdminService
*/
public function pay(string $type, string $trade_type, int $trade_id, string $return_url = '', string $quit_url = '', string $buyer_id = '', string $voucher = '', string $openid = '')
{
return ( new CorePayService() )->pay($trade_type, $trade_id, $type, ChannelDict::PC, $openid, $return_url, $quit_url, $buyer_id, $voucher);
return (new CorePayService())->pay($trade_type, $trade_id, $type, ChannelDict::PC, $openid, $return_url, $quit_url, $buyer_id, $voucher);
}
/**
@ -125,7 +125,7 @@ class PayService extends BaseAdminService
*/
public function getInfoByTrade(string $trade_type, int $trade_id)
{
return ( new CorePayService() )->getInfoByTrade($trade_type, $trade_id, ChannelDict::H5);
return (new CorePayService())->getInfoByTrade($trade_type, $trade_id, ChannelDict::H5);
}
/**
@ -136,26 +136,26 @@ class PayService extends BaseAdminService
*/
public function getFriendspayInfoByTrade(string $trade_type, int $trade_id, string $channel)
{
$pay_info = ( new CorePayService() )->getInfoByTrade($trade_type, $trade_id, ChannelDict::H5, PaySceneDict::FRIENDSPAY);
$pay_info = (new CorePayService())->getInfoByTrade($trade_type, $trade_id, ChannelDict::H5, PaySceneDict::FRIENDSPAY);
if (!empty($pay_info)) {
//海报
$poster = ( new Poster() )->field('id')->where([
[ 'type', '=', 'friendspay' ],
[ 'status', '=', 1 ],
[ 'is_default', '=', 1 ]
$poster = (new Poster())->field('id')->where([
['type', '=', 'friendspay'],
['status', '=', 1],
['is_default', '=', 1]
])->findOrEmpty()->toArray();
if (!empty($poster)) {
$pay_info[ 'poster_id' ] = $poster[ 'id' ];
$pay_info['poster_id'] = $poster['id'];
}
//发起帮付会员信息
$member = ( new Member() )->field('member_id,nickname,headimg')->where([
[ 'member_id', '=', $pay_info[ 'from_main_id' ] ]
$member = (new Member())->field('member_id,nickname,headimg')->where([
['member_id', '=', $pay_info['from_main_id']]
])->findOrEmpty()->toArray();
$pay_info[ 'member' ] = $member;
$pay_info['member'] = $member;
//二维码
$qrcode = $this->getQrcode($trade_type, $trade_id, $channel);
$pay_info[ 'link' ] = $qrcode[ 'url' ];
$pay_info[ 'qrcode' ] = $qrcode[ 'path' ];
$pay_info['link'] = $qrcode['url'];
$pay_info['qrcode'] = $qrcode['path'];
}
return $pay_info;
}
@ -168,7 +168,7 @@ class PayService extends BaseAdminService
*/
public function getQrcode(string $trade_type, int $trade_id, string $channel)
{
$url = ( new CoreSysConfigService() )->getSceneDomain()[ 'wap_url' ];
$url = (new CoreSysConfigService())->getSceneDomain()['wap_url'];
$page = 'app/pages/friendspay/money';
$data = [
@ -193,7 +193,7 @@ class PayService extends BaseAdminService
$url = $url . '/' . $page;
$scene = [];
foreach ($data as $v) {
$scene[] = $v[ 'key' ] . '=' . $v[ 'value' ];
$scene[] = $v['key'] . '=' . $v['value'];
}
$url .= '?' . implode('&', $scene);
@ -212,11 +212,11 @@ class PayService extends BaseAdminService
*/
public function getPayTypeList()
{
$pay_type_list = ( new CorePayService() )->getPayTypeByTrade('', ChannelDict::H5);
$pay_type_list = (new CorePayService())->getPayTypeByTrade('', ChannelDict::H5);
if (!empty($pay_type_list)) {
foreach ($pay_type_list as $k => $v) {
if (!in_array($v['key'], [ PayDict::BALANCEPAY, PayDict::FRIENDSPAY ])) {
unset($pay_type_list[ $k ]);
if (!in_array($v['key'], [PayDict::BALANCEPAY, PayDict::FRIENDSPAY])) {
unset($pay_type_list[$k]);
}
}
$pay_type_list = array_values($pay_type_list);
@ -224,17 +224,18 @@ class PayService extends BaseAdminService
return $pay_type_list;
}
public function order_pay($data){
$out_trade_no = 'sm'.date("YmdHis").time();
public function order_pay($data)
{
$out_trade_no = 'sm' . date("YmdHis") . time();
$order = new OrderTable();
$order_info = $order->where(['id' => $data['order_id']])->find();
$cr = new CustomerResources();
$resource_info = $cr->where(['id' => $order_info['resource_id']])->find();
$config = return_pay_config($resource_info['campus'],$data['order_id']);
$config = return_pay_config($resource_info['campus'], $data['order_id']);
$params = [
'out_trade_no' => $out_trade_no,
'body' => '订单扫码支付:'.$out_trade_no,
'body' => '订单扫码支付:' . $out_trade_no,
'money' => $order_info['order_amount'] * 100,
];
@ -242,15 +243,16 @@ class PayService extends BaseAdminService
$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']]);
return ['qrcode_url' => getCurrentDomain().$path,'out_trade_no'=>$out_trade_no];
$order->where(['id' => $data['order_id']])->update(['payment_id' => $out_trade_no, 'ipv3' => $config['mch_secret_key']]);
return ['qrcode_url' => getCurrentDomain() . $path, 'out_trade_no' => $out_trade_no, 'code_url' => $url['code_url']];
}
public function check_payment_status($data){
public function check_payment_status($data)
{
$order = new OrderTable();
$order_status = $order->where(['payment_id' => $data['out_trade_no']])->value("order_status");
return ['order_status'=>$order_status];
return ['order_status' => $order_status];
}
}

7
uniapp/api/apiRoute.js

@ -387,7 +387,10 @@ export default {
//更新学生课程人员配置
async updateStudentCoursePersonnel(data = {}) {
return await http.post('/updateStudentCoursePersonnel', data);
}
},
// 获取订单支付二维码
async getOrderPayQrcode(data = {}) {
return await http.get('/getQrcode', data);
},
}

70
uniapp/components/custom-modal/custom-modal.vue

@ -0,0 +1,70 @@
<template>
<fui-modal :buttons="[]" :width="width" :show="show" :maskClose="maskClose">
<!-- 默认内容插槽 -->
<slot>
<!-- 默认内容 -->
</slot>
<!-- 按钮插槽 -->
<view v-if="$slots.buttons" class="button-section">
<slot name="buttons"></slot>
</view>
<!-- 关闭按钮 -->
<view v-if="showClose" class="fui-icon__close" @tap="handleClose">
<fui-icon name="close" color="#B2B2B2" :size="48"></fui-icon>
</view>
</fui-modal>
</template>
<script>
export default {
name: 'CustomModal',
props: {
//
show: {
type: Boolean,
default: false
},
//
width: {
type: [String, Number],
default: 600
},
//
showClose: {
type: Boolean,
default: true
},
//
maskClose: {
type: Boolean,
default: true
}
},
methods: {
//
handleClose() {
this.$emit('cancel', 'close')
}
}
}
</script>
<style lang="less" scoped>
.button-section {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
gap: 20rpx;
margin-top: 40rpx;
}
.fui-icon__close {
position: absolute;
right: 24rpx;
top: 20rpx;
z-index: 1000;
}
</style>

234
uniapp/components/custom-modal/example.vue

@ -0,0 +1,234 @@
<template>
<view class="container">
<fui-button @click="showSuccessModal = true" text="显示成功弹窗"></fui-button>
<fui-button @click="showConfirmModal = true" text="显示确认弹窗"></fui-button>
<fui-button @click="showCustomModal = true" text="显示自定义弹窗"></fui-button>
<!-- 成功弹窗示例 -->
<custom-modal
:show="showSuccessModal"
width="600"
@cancel="handleModalCancel"
>
<fui-icon name="checkbox-fill" :size="108" color="#09BE4F"></fui-icon>
<text class="fui-title">购买成功</text>
<text class="fui-descr">成功购买一张月卡可免费阅读30天</text>
<template #buttons>
<fui-button
text="我知道了"
width="240rpx"
height="72rpx"
:size="28"
radius="36rpx"
background="#FFB703"
borderWidth="0"
:margin="['0','0','24rpx']"
@click="handleButtonClick('success_confirm')"
/>
</template>
</custom-modal>
<!-- 确认弹窗示例 -->
<custom-modal
:show="showConfirmModal"
width="500"
@cancel="handleModalCancel"
>
<fui-icon name="warning-fill" :size="108" color="#FF6B35"></fui-icon>
<text class="fui-title">确认删除</text>
<text class="fui-descr">删除后无法恢复确定要继续吗</text>
<template #buttons>
<fui-button
text="取消"
width="200rpx"
height="72rpx"
:size="28"
radius="36rpx"
background="#F5F5F5"
color="#333"
borderWidth="0"
:margin="['0','0','12rpx']"
@click="handleButtonClick('confirm_cancel')"
/>
<fui-button
text="确定删除"
width="200rpx"
height="72rpx"
:size="28"
radius="36rpx"
background="#FF6B35"
borderWidth="0"
@click="handleButtonClick('confirm_delete')"
/>
</template>
</custom-modal>
<!-- 自定义内容弹窗示例 -->
<custom-modal
:show="showCustomModal"
width="700"
:showClose="false"
@cancel="handleModalCancel"
>
<view class="custom-content">
<text class="custom-title">支付二维码</text>
<view class="custom-form">
<fui-qrcode :value="qrcode"></fui-qrcode>
</view>
</view>
<template #buttons>
<view class="button-row">
<fui-button
text="发送二维码给用户"
width="200rpx"
height="72rpx"
:size="28"
radius="36rpx"
background="#007AFF"
borderWidth="0"
@click="handleButtonClick('custom_submit')"
/>
</view>
</template>
</custom-modal>
</view>
</template>
<script>
import CustomModal from './custom-modal.vue'
export default {
components: {
CustomModal
},
data() {
return {
showSuccessModal: false,
showConfirmModal: false,
showCustomModal: false,
qrcode: 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=TICKET',
formData: {
name: '',
phone: ''
}
}
},
methods: {
//
handleModalCancel(type) {
console.log('弹窗取消:', type)
this.showSuccessModal = false
this.showConfirmModal = false
this.showCustomModal = false
},
//
handleButtonClick(action) {
console.log('按钮点击:', action)
switch(action) {
case 'success_confirm':
this.showSuccessModal = false
uni.showToast({
title: '确认成功',
icon: 'success'
})
break
case 'confirm_cancel':
this.showConfirmModal = false
break
case 'confirm_delete':
this.showConfirmModal = false
uni.showToast({
title: '删除成功',
icon: 'success'
})
break
case 'custom_cancel':
this.showCustomModal = false
break
case 'custom_submit':
if (!this.formData.name || !this.formData.phone) {
uni.showToast({
title: '请填写完整信息',
icon: 'none'
})
return
}
this.showCustomModal = false
uni.showToast({
title: '提交成功',
icon: 'success'
})
//
this.formData = {
name: '',
phone: ''
}
break
}
}
}
}
</script>
<style lang="less" scoped>
.container {
padding: 40rpx;
display: flex;
flex-direction: column;
gap: 30rpx;
}
.fui-title {
font-size: 36rpx;
font-weight: bold;
color: #333;
text-align: center;
margin: 20rpx 0;
}
.fui-descr {
font-size: 28rpx;
color: #666;
text-align: center;
margin: 0 0 30rpx 0;
line-height: 1.5;
}
.custom-content {
width: 100%;
padding: 20rpx;
}
.custom-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
text-align: center;
display: block;
margin-bottom: 30rpx;
}
.custom-form {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.button-row {
display: flex;
justify-content: space-between;
align-items: center;
gap: 40rpx;
}
</style>

7
uniapp/pages.json

@ -177,7 +177,7 @@
{
"path": "pages/common/im_chat_info",
"style": {
"navigationBarTitleText": "",
"navigationBarTitleText": "消息",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#292929",
"navigationBarTextStyle": "white"
@ -677,9 +677,8 @@
{
"path": "pages/market/clue/clue_table",
"style": {
"navigationBarTitleText": "线索统计表",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#18181c",
"navigationBarTitleText": "数据统计",
"navigationBarBackgroundColor": "#292929",
"navigationBarTextStyle": "white"
}
}

120
uniapp/pages/market/clue/clue_table.vue

@ -1,31 +1,42 @@
<template>
<view class="dark-table-container">
<scroll-view scroll-x="true" class="table-scroll">
<view class="table">
<!-- 表头 -->
<view class="table-row table-header">
<view class="table-cell" v-for="(col, idx) in columns" :key="idx">
<view v-for="(row, rIdx) in data" :key="rIdx" class="card">
<view class="card-title" @click="toggleExpand(rIdx)">
{{ row.channel }}
<text class="expand-icon">{{ expanded[rIdx] ? '▲' : '▼' }}</text>
</view>
<view class="card-content">
<view
class="card-row"
v-for="(col, cIdx) in getVisibleColumns(rIdx)"
:key="cIdx"
>
<view class="card-label">
{{ col.label }}
<text v-if="col.tip" class="tip" @click="showTip(col.tip)">?</text>
</view>
</view>
<!-- 数据行 -->
<view class="table-row" v-for="(row, rIdx) in data" :key="rIdx">
<view class="table-cell" v-for="(col, cIdx) in columns" :key="cIdx">
{{ row[col.key] || '-' }}
<text v-if="col.tip" class="tip" @click.stop="showTip(col.tip)">?</text>
</view>
<view class="card-value">{{ row[col.key] || '-' }}</view>
</view>
</view>
</scroll-view>
<view v-if="columns.length > 6" class="expand-btn" @click="toggleExpand(rIdx)">
{{ expanded[rIdx] ? '收起' : '展开全部' }}
</view>
</view>
<!-- 说明弹窗 -->
<uni-popup ref="popup" type="center">
<view class="popup-content">{{ tipContent }}</view>
</uni-popup>
<AQTabber></AQTabber>
</view>
</template>
<script>
import AQTabber from "@/components/AQ/AQTabber.vue"
export default {
components: {
AQTabber,
},
data() {
return {
columns: [
@ -48,13 +59,23 @@ export default {
data: [
{ channel: '体检包(地推)', resource: 10, visit1: 5, visitRate1: '50%', visit2: 2, visitRate2: '40%', close1: 1, closeRate1: '20%', close2: 1, closeRate2: '50%', monthTrans: '10%', lastMonthVisit: 0, monthTotalVisit: 5, lastMonthClose: 0, monthTotalClose: 1 },
],
tipContent: ''
tipContent: '',
expanded: {},
}
},
methods: {
showTip(content) {
this.tipContent = content
this.$refs.popup.open()
},
toggleExpand(idx) {
this.$set(this.expanded, idx, !this.expanded[idx])
},
getVisibleColumns(idx) {
// 5
const cols = this.columns.slice(1)
if (this.expanded[idx]) return cols
return cols.slice(0, 5)
}
}
}
@ -65,29 +86,58 @@ export default {
background: #18181c;
color: #f1f1f1;
min-height: 100vh;
padding: 16rpx;
padding: 24rpx 12rpx;
}
.card {
background: #23232a;
border-radius: 18rpx;
box-shadow: 0 4rpx 24rpx rgba(0,0,0,0.18);
margin-bottom: 32rpx;
padding: 24rpx 20rpx 8rpx 20rpx;
transition: box-shadow 0.2s;
}
.card-title {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 18rpx;
color: #ffb300;
letter-spacing: 2rpx;
display: flex;
align-items: center;
justify-content: space-between;
cursor: pointer;
}
.table-scroll {
width: 100%;
overflow-x: auto;
.expand-icon {
font-size: 24rpx;
color: #bdbdbd;
margin-left: 12rpx;
}
.table {
min-width: 1200rpx;
.card-content {
display: flex;
flex-direction: column;
gap: 12rpx;
overflow: hidden;
transition: max-height 0.3s;
}
.table-row {
.card-row {
display: flex;
border-bottom: 1px solid #333;
justify-content: space-between;
align-items: center;
border-bottom: 1px dashed #333;
padding: 8rpx 0;
}
.table-header {
background: #23232a;
font-weight: bold;
.card-label {
color: #bdbdbd;
font-size: 26rpx;
display: flex;
align-items: center;
}
.table-cell {
flex: 0 0 180rpx;
padding: 16rpx 8rpx;
text-align: center;
border-right: 1px solid #333;
position: relative;
.card-value {
color: #f1f1f1;
font-size: 26rpx;
text-align: right;
max-width: 60%;
word-break: break-all;
}
.tip {
color: #ffb300;
@ -95,6 +145,14 @@ export default {
font-size: 24rpx;
cursor: pointer;
}
.expand-btn {
color: #ffb300;
text-align: center;
font-size: 26rpx;
margin: 10rpx 0 0 0;
padding-bottom: 8rpx;
cursor: pointer;
}
.popup-content {
background: #23232a;
color: #fff;

737
uniapp/pages/market/clue/order_list.vue

File diff suppressed because it is too large
Loading…
Cancel
Save