Browse Source

修改 bug

master
王泽彦 9 months ago
parent
commit
1fe69f1ad0
  1. 35
      niucloud/app/api/controller/apiController/OrderTable.php
  2. 68
      uniapp/pages/market/clue/clue_info.vue
  3. 8
      uniapp/pages/market/clue/order_list.vue

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

@ -72,21 +72,42 @@ class OrderTable extends BaseApiService
//订单-创建
public function add(Request $request)
{
// 获取当前登录的员工ID
$staff_id = request()->personnel_id ?? 0;
$params = $request->params([
["payment_type", ""], // 付款类型必填验证
["course_id", ""], // 课程ID必填验证
["class_id", ""], // 班级ID必填验证
["staff_id", ""], // 员工ID必填验证
["staff_id", ""], // 员工ID(可选)
["resource_id", ""], // 客户资源表ID必填验证
]);
foreach($params as $k=>$v){
if(empty($v)){
return fail('缺少参数');
// 验证必要参数
if(empty($params['payment_type']) || empty($params['course_id']) ||
empty($params['class_id']) || empty($params['resource_id'])) {
return fail('缺少必要参数');
}
// 如果前端没提供员工ID,使用当前登录的员工ID
if(empty($params['staff_id'])) {
if(empty($staff_id)) {
return fail('无法获取员工信息');
}
$params['staff_id'] = $staff_id;
}
// 获取班级信息以查询campus_id
$class = \app\model\class_grade\ClassGrade::where('id', $params['class_id'])->find();
if (!$class) {
return fail('班级不存在');
}
$class = $class->toArray();
$campus_id = $class['campus_id'] ?? 0;
if(empty($campus_id)) {
return fail('班级没有关联校区');
}
$course = \app\model\course\Course::where('id', $params['course_id'])->find();
if (!$course) {
@ -95,7 +116,6 @@ class OrderTable extends BaseApiService
$course = $course->toArray();
$order_amount = $course['price'];//课程的价格
$data = [
'payment_type' => $params['payment_type'],//付款类型: cash-现金支付, scan_code-扫码支付, subscription-订阅支付
'order_amount' => $order_amount,//订单金额
@ -103,12 +123,9 @@ class OrderTable extends BaseApiService
'class_id' => $params['class_id'],//班级ID
'staff_id' => $params['staff_id'],//员工表ID
'resource_id' => $params['resource_id'],//客户资源表id
'campus_id' => $campus_id,//校区ID
];
$res = (new OrderTableService())->addData($data);
if (!$res['code']) {

68
uniapp/pages/market/clue/clue_info.vue

@ -216,11 +216,11 @@
<!-- 添加备注弹窗 -->
<uni-popup ref="remarkPopup" type="dialog">
<uni-popup-dialog
:title="currentRecord ? `添加备注 (${currentRecord.name || '未知'})` : '添加备注'"
:before-close="true"
@confirm="confirmRemark"
@close="closeRemark">
<view class="custom-popup-dialog">
<view class="dialog-header">
<text class="dialog-title">通话备注</text>
</view>
<view class="dialog-content">
<view class="remark-textarea-container">
<textarea
class="remark-textarea"
@ -230,7 +230,12 @@
></textarea>
<text class="remark-count">{{remark_content.length}}/200</text>
</view>
</uni-popup-dialog>
</view>
<view class="dialog-footer">
<view class="dialog-btn cancel-btn" @click="closeRemark">取消</view>
<view class="dialog-btn confirm-btn" @click="confirmRemark">确定</view>
</view>
</view>
</uni-popup>
<!-- 教练配置编辑弹窗 -->
@ -304,7 +309,6 @@
components: {
//
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
uniPopupDialog: () => import('@/components/uni-popup/uni-popup-dialog.vue'),
},
data() {
return {
@ -680,7 +684,7 @@
});
} finally {
uni.hideLoading();
this.$refs.remarkPopup.close();
this.closeRemark();
}
},
@ -1227,6 +1231,52 @@
padding: 0 30rpx;
}
//
.custom-popup-dialog {
width: 650rpx;
border-radius: 16rpx;
background-color: #fff;
overflow: hidden;
}
.dialog-header {
padding: 30rpx;
text-align: center;
border-bottom: 1px solid #eee;
}
.dialog-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.dialog-content {
padding: 30rpx;
}
.dialog-footer {
display: flex;
border-top: 1px solid #eee;
}
.dialog-btn {
flex: 1;
padding: 25rpx 0;
text-align: center;
font-size: 30rpx;
}
.cancel-btn {
color: #666;
border-right: 1px solid #eee;
}
.confirm-btn {
color: #29D3B4;
font-weight: bold;
}
//
.remark-textarea-container {
width: 100%;
@ -1236,7 +1286,7 @@
.remark-textarea {
width: 100%;
height: 200rpx;
height: 240rpx;
border: 1px solid #ddd;
border-radius: 8rpx;
padding: 20rpx;

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

@ -557,13 +557,7 @@ export default {
})
return
}
if(!param.staff_id){
uni.showToast({
title: '员工信息缺失',
icon: 'none'
})
return
}
// ID
if(!param.money){
uni.showToast({
title: '订单金额为空',

Loading…
Cancel
Save