修改:酒水卡额度兑换商品流程修改

This commit is contained in:
wuhui_zzw 2024-02-05 17:36:57 +08:00
parent 779f871171
commit 860555eabc
7 changed files with 60 additions and 18 deletions

View File

@ -204,6 +204,7 @@ class User extends BaseModel
->hasWhere('merchant',function($query){
$query->where('is_del', 0)
->where('mer_state', 1)
->where('merchant_type', 0)
->where('status', 1);
})
->where('uid',$this->uid)
@ -217,7 +218,26 @@ class User extends BaseModel
return !empty($info) ? $info->toArray() : null;
}
// 用户是否存在酒道馆 有效店员信息
public function getShopMerServiceAttr($value){
$info = (new StoreService())
->field('service_id,uid,nickname,avatar,customer,StoreService.mer_id,is_verify,is_goods,is_open')
->hasWhere('merchant',function($query){
$query->where('is_del', 0)
->where('mer_state', 1)
->where('merchant_type', 1)
->where('status', 1);
})
->where('uid',$this->uid)
->where('StoreService.mer_id','<>',0)
->where('StoreService.is_del',0)
->where('is_open',1)
->order('StoreService.is_verify DESC,StoreService.customer DESC')
// ->fetchSql()
->find();
return !empty($info) ? $info->toArray() : null;
}
public function topService()
{
@ -229,6 +249,9 @@ class User extends BaseModel
->order('is_verify DESC,customer DESC');
}
public function getLockBrokerageAttr()
{
return app()->make(UserBillRepository::class)->lockBrokerage($this->uid) ?: 0;

View File

@ -85,10 +85,12 @@ class StoreServiceRepository extends BaseRepository
Elm::switches('status', '客服状态', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('customer', '订单管理', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('is_goods', '商品管理', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('is_verify', '开启核销', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('is_verify', '核销权限', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('is_user', '客户管理', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('staff_manage', '员工管理', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('qr_code_show', '推广二维码', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('staff_manage', '品牌管理', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('qr_code_show', '推广码', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('online_payment', '买单码', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('product_exchange', '商品兑换码', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('notify', '订单通知', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8)->control([
[
'value' => 1,
@ -96,22 +98,24 @@ class StoreServiceRepository extends BaseRepository
Elm::input('phone', '通知电话')
]
]
])
];
]),
];
$filed = [
"value" => 1,
"rule" => [
"status","customer","is_goods","is_verify","notify",'phone',"is_user","staff_manage",'qr_code_show'
"status","customer","is_goods","is_verify","notify",'phone',"is_user","staff_manage",'qr_code_show','online_payment','product_exchange'
]
];
}else if($merchantType == 1){
$adminRule = [
Elm::switches('is_verify', '核销权限', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('product_exchange', '商品兑换码', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('purchase_permission', '进货权限', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
];
$filed = [
"value" => 1,
"rule" => [
"is_verify"
"is_verify",'product_exchange','purchase_permission'
]
];
}else if($merchantType == 2){
@ -182,8 +186,8 @@ class StoreServiceRepository extends BaseRepository
public function getServices($uid, array $where = [],$is_sys = 1){
$where['uid'] = $uid;
$list = $this->dao->getSearch([])
->hasWhere('merchant',function($query){
$query->where('is_del', 0)->where('merchant_type', 0);
->hasWhere('merchant',function($query) use ($is_sys){
$query->where('is_del', 0)->where('merchant_type', $is_sys == 2 ? 1 : 0);
})
->where('StoreService.is_del',0)
->where('StoreService.mer_id',$is_sys == 1 ? '=' : '>',0)
@ -204,7 +208,7 @@ class StoreServiceRepository extends BaseRepository
})
->with([
'merchant' => function($query){
$query->field('mer_id,mer_avatar,mer_name');
$query->field('mer_id,mer_avatar,mer_name,merchant_type');
}
])
->order('StoreService.mer_id DESC')
@ -309,7 +313,7 @@ class StoreServiceRepository extends BaseRepository
public function isService(int $uid,int $id = 0,int $merId = 0):bool{
$count = $this->dao->getSearch([])
->hasWhere('merchant',function($query){
$query->where('is_del', 0);
$query->where('is_del', 0)->where('merchant_type', 0);
})
->where('StoreService.uid',$uid)
->where('StoreService.is_del', 0)

View File

@ -139,7 +139,7 @@ class Auth extends BaseController
public function userInfo()
{
$user = $this->request->userInfo()->hidden(['label_id', 'group_id', 'pwd', 'addres', 'card_id', 'last_time', 'last_ip', 'create_time', 'mark', 'status', 'spread_uid', 'spread_time', 'real_name', 'birthday', 'brokerage_price']);
$user->append(['service', 'topService', 'total_collect_product', 'total_collect_store', 'total_coupon', 'total_visit_product', 'total_unread', 'total_recharge', 'lock_integral', 'total_integral']);
$user->append(['service', 'topService','shopMerService', 'total_collect_product', 'total_collect_store', 'total_coupon', 'total_visit_product', 'total_unread', 'total_recharge', 'lock_integral', 'total_integral']);
$data = $user->toArray();
$data['total_consume'] = $user['pay_price'];
$data['extension_status'] = systemConfig('extension_status');

View File

@ -113,7 +113,10 @@ class Service extends BaseController{
'avatar',
'phone',
['sort',0],
'qr_code_show'
'qr_code_show',
'online_payment',
'product_exchange',
'purchase_permission'
]);
if(is_array(json_decode($data['uid'], true))) $data['uid'] = json_decode($data['uid'], true);
// 是否编辑
@ -143,7 +146,7 @@ class Service extends BaseController{
$query->field('avatar,uid');
},
'merchant' => function($query){
$query->field('mer_id,mer_name,mer_avatar')->bind(['mer_name','mer_avatar']);
$query->field('mer_id,mer_name,mer_avatar,merchant_type')->bind(['mer_name','mer_avatar','merchant_type']);
}
])->toArray();
if($service['user'] ?? null){

View File

@ -190,7 +190,7 @@ class Exchange extends BaseController{
->findOrEmpty()
->toArray();
// 判断:是否存在指定消费者,不存在则使用当前登录用户
if ($service['uid'] == $uid) return app('json')->fail('操作员和消费用户不能是同一人!');
// if ($service['uid'] == $uid) return app('json')->fail('操作员和消费用户不能是同一人!');
// 支付信息
$payInfo = $this->request->params(['pay_type', 'return_url']);
$payInfo['money'] = (float)$data['diff_money_pay'];
@ -198,7 +198,9 @@ class Exchange extends BaseController{
// 添加兑换记录
try{
return Db::transaction(function () use ($data, $uid, $payInfo, $orderCreateRepository, $service) {
// 添加兑换记录
// 商户类别0=普通商户1=酒道馆2=供应商
$merchantType = (int)app()->make(MerchantRepository::class)->getSearch(['mer_id'=>$service['mer_id']])->value('merchant_type');
// 添加兑换记录 额度类型1=酒卡额度2=菜卡额度
$pickupRecordId = ExchangePickupRecord::insertGetId([
'uid' => $uid,
'point_id' => $service['mer_id'],
@ -207,7 +209,7 @@ class Exchange extends BaseController{
'use_integral' => $data['use_integral'],
'diff_money' => $data['diff_money'],
'diff_money_pay' => $data['diff_money_pay'],
'quota_type' => $data['quota_type']
'quota_type' => $merchantType == 1 ? 1 : 2,// 酒道馆核销酒卡额度,普通商户核销菜卡额度
]);
// 判断如果【差价应支付金额】大于0 生成支付订单
if((float)$payInfo['money'] > 0){

View File

@ -6,6 +6,7 @@
namespace app\controller\merchant;
use app\common\repositories\system\merchant\MerchantRepository;
use app\common\repositories\user\UserRepository;
use crmeb\basic\BaseController;
use app\common\repositories\store\order\StoreOrderProductRepository;
@ -269,6 +270,12 @@ class Common extends BaseController
{
$data = systemConfig(['tx_map_key','delivery_status','delivery_type','rmargin_emind_switch']);
$data['mer_id'] = $this->request->merId();
$data['merchant_type'] = 0;
// 判断存在merid 判断商户类型
if((int)$data['mer_id'] > 0){
$data['merchant_type'] = (int)app()->make(MerchantRepository::class)->getSearch(['mer_id'=>$data['mer_id']])->value('merchant_type');
}
return app('json')->success($data);
}
}

View File

@ -108,7 +108,10 @@ class StoreService extends BaseController
'avatar',
'phone',
['sort',0],
'qr_code_show'
'qr_code_show',
'online_payment',
'product_exchange',
'purchase_permission'
]);
if ($isUpdate) {
$validate->update();