【增加】区域代理订单
This commit is contained in:
parent
f695627a78
commit
545d17653b
|
|
@ -14,6 +14,7 @@ namespace addon\fenxiao\api\controller;
|
|||
use addon\fenxiao\model\FenxiaoAccount;
|
||||
use addon\fenxiao\model\Fenxiao as FenxiaoModel;
|
||||
use app\api\controller\BaseApi;
|
||||
use app\model\member\MemberAccount;
|
||||
|
||||
/**
|
||||
* 分销商流水
|
||||
|
|
@ -33,6 +34,7 @@ class Account extends BaseApi
|
|||
|
||||
$page = isset($this->params['page']) ? $this->params['page'] : 1;
|
||||
$page_size = isset($this->params['page_size']) ? $this->params['page_size'] : PAGE_LIST_ROWS;
|
||||
$type = isset($this->params['type']) ? $this->params['type'] : '';
|
||||
|
||||
$model = new FenxiaoModel();
|
||||
$fenxiao_info = $model->getFenxiaoInfo([['member_id', '=', $this->member_id]], 'fenxiao_id');
|
||||
|
|
@ -41,6 +43,11 @@ class Account extends BaseApi
|
|||
$condition = [
|
||||
['fenxiao_id', '=', $fenxiao_info['fenxiao_id']]
|
||||
];
|
||||
if($type != '' && $type != 'undefined'){
|
||||
$condition[] = [
|
||||
['type', '=', $type]
|
||||
];
|
||||
}
|
||||
|
||||
$account_model = new FenxiaoAccount();
|
||||
$list = $account_model->getFenxiaoAccountPageList($condition, $page, $page_size);
|
||||
|
|
@ -49,4 +56,41 @@ class Account extends BaseApi
|
|||
return $this->response($this->error('', 'FENXIAO_NOT_EXIST'));
|
||||
}
|
||||
|
||||
public function goufang_to_balance(){
|
||||
$token = $this->checkToken();
|
||||
if ($token['code'] < 0) return $this->response($token);
|
||||
|
||||
$apply_money = isset($this->params['apply_money']) ? $this->params['apply_money'] : 0;
|
||||
$type = isset($this->params['type']) ? $this->params['type'] : '';
|
||||
if($apply_money <= 0 || $type == ''){
|
||||
return $this->response($this->error('','参数错误'));
|
||||
}
|
||||
if($apply_money % 100 != 0){
|
||||
return $this->response($this->error('','转换金额需为100的整数倍'));
|
||||
}
|
||||
$model = new FenxiaoModel();
|
||||
$menber_account = new MemberAccount();
|
||||
$fenxiao_account = new FenxiaoAccount();
|
||||
$fenxiao_info = $model->getFenxiaoInfo([['member_id', '=', $this->member_id]])['data'];
|
||||
switch($type){
|
||||
case 'goufang_to_balance':
|
||||
if($fenxiao_info['house_purchase'] < $apply_money){
|
||||
return $this->response($this->error('','购房券不足'));
|
||||
}
|
||||
$menber_account->addMemberAccount($fenxiao_info[ 'site_id' ], $fenxiao_info['member_id'], 'balance_money', $apply_money, 'goufang_to_balance', '购房券转换', '购房券转换');
|
||||
$fenxiao_account->addAccount($fenxiao_info['fenxiao_id'], $fenxiao_info['fenxiao_name'], 'house_purchase', -$apply_money, 0,'house_purchase', '购房券转换');
|
||||
break;
|
||||
case 'balance_to_goufang':
|
||||
$res = $menber_account->addMemberAccount($fenxiao_info[ 'site_id' ], $fenxiao_info['member_id'], 'balance_money', -$apply_money, 'goufang_to_balance', '购房券转换', '购房券转换');
|
||||
if($res['code'] < 0){
|
||||
return $this->response($res);
|
||||
}
|
||||
$fenxiao_account->addAccount($fenxiao_info['fenxiao_id'], $fenxiao_info['fenxiao_name'], 'house_purchase', $apply_money, 0,'house_purchase', '购房券转换');
|
||||
break;
|
||||
default:
|
||||
return $this->response($this->error('','参数错误'));
|
||||
}
|
||||
return $this->response($this->success());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -115,9 +115,9 @@ class Order extends BaseApi
|
|||
return $this->response($list);
|
||||
}
|
||||
|
||||
// public function testDaySettlement(){
|
||||
// return $this->response(event("DaySettlement"));
|
||||
// }
|
||||
public function testDaySettlement(){
|
||||
return $this->response(event("DaySettlement"));
|
||||
}
|
||||
//
|
||||
// public function testAreaMonthlyReward(){
|
||||
// event("AreaMonthlyReward");
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class Ageen extends BaseModel
|
|||
public function getPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = '', $field = '*')
|
||||
{
|
||||
$condition[] = [ 'f.is_delete', '=', 0 ];
|
||||
$field = 'f.*,pf.fenxiao_name as parent_name,m.username,m.nickname,m.mobile as member_mobile,m.headimg,a.agent_level_id,a.agent_level_name,a.id';
|
||||
$field = 'f.*,pf.fenxiao_name as parent_name,m.username,m.nickname,m.mobile as member_mobile,m.headimg,a.agent_level_id,a.agent_level_name,a.id,pa.name as province_name,ca.name as city_name,da.name as district_name,a.province_id,a.city_id,a.district_id';
|
||||
$alias = 'a';
|
||||
$join = [
|
||||
[
|
||||
|
|
@ -117,6 +117,21 @@ class Ageen extends BaseModel
|
|||
'm.member_id = f.member_id',
|
||||
'left'
|
||||
],
|
||||
[
|
||||
'area pa',
|
||||
'pa.id = a.province_id',
|
||||
'left'
|
||||
],
|
||||
[
|
||||
'area ca',
|
||||
'ca.id = a.city_id',
|
||||
'left'
|
||||
],
|
||||
[
|
||||
'area da',
|
||||
'da.id = a.district_id',
|
||||
'left'
|
||||
],
|
||||
];
|
||||
$list = model('fenxiao_agent')->pageList($condition, $field, $order, $page, $page_size, $alias, $join);
|
||||
// $list = model('fenxiao_agent')->pageList($condition, $field, $order, $page, $page_size);
|
||||
|
|
|
|||
|
|
@ -519,10 +519,10 @@ class FenxiaoOrder extends BaseModel
|
|||
/**
|
||||
* 查询分销订单列表(管理端调用)
|
||||
*/
|
||||
public function getFenxiaoOrderPage($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = 'order_id DESC')
|
||||
public function getFenxiaoOrderPage($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = 'fo.order_id DESC')
|
||||
{
|
||||
$field = 'order_id,order_no,site_name,member_name,create_time,is_settlement,fenxiao_order_id';
|
||||
$list = model('fenxiao_order')->pageList($condition, $field, $order, $page, $page_size, 'fo', [], 'order_id');
|
||||
$field = 'fo.order_id,fo.order_no,fo.site_name,fo.member_name,fo.create_time,fo.is_settlement,fo.fenxiao_order_id';
|
||||
$list = model('fenxiao_order')->pageList($condition, $field, $order, $page, $page_size, 'fo', [['order o','fo.order_id=o.order_id','LEFT']], 'fo.order_id');
|
||||
if (!empty($list[ 'list' ])) {
|
||||
foreach ($list[ 'list' ] as $k => $item) {
|
||||
$order_info = model('order')->getInfo([ [ 'order_id', '=', $item[ 'order_id' ] ] ], 'name,full_address,mobile,order_status_name');
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
namespace addon\fenxiao\shop\controller;
|
||||
|
||||
use addon\fenxiao\model\FenxiaoOrder;
|
||||
use app\model\system\Address as AddressModel;
|
||||
use app\shop\controller\BaseShop;
|
||||
|
||||
/**
|
||||
|
|
@ -61,6 +62,19 @@ class Order extends BaseShop
|
|||
} elseif (!empty($start_time) && !empty(date_to_time($end_time))) {
|
||||
$condition[] = [ 'fo.create_time', 'between', [ date_to_time($start_time), date_to_time($end_time) ] ];
|
||||
}
|
||||
$province_id = input('province_id', 0);
|
||||
$city_id = input('city_id', 0);
|
||||
$district_id = input('district_id', 0);
|
||||
|
||||
if($province_id != 0){
|
||||
$condition[] = ['o.province_id', '=', $province_id];
|
||||
}
|
||||
if($city_id != 0){
|
||||
$condition[] = ['o.city_id', '=', $city_id];
|
||||
}
|
||||
if($district_id != 0){
|
||||
$condition[] = ['o.district_id', '=', $district_id];
|
||||
}
|
||||
|
||||
$list = $model->getFenxiaoOrderPage($condition, $page_index, $page_size);
|
||||
|
||||
|
|
@ -69,6 +83,10 @@ class Order extends BaseShop
|
|||
} else {
|
||||
// $this->forthMenu();
|
||||
//订单状态
|
||||
//查询省级数据列表
|
||||
$address_model = new AddressModel();
|
||||
$list = $address_model->getAreaList([["pid", "=", 0], ["level", "=", 1]]);
|
||||
$this->assign("province_list", $list["data"]);
|
||||
return $this->fetch('order/lists', [], $this->replace);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@
|
|||
<div class="ns-table-btn">
|
||||
<a class="layui-btn" lay-event="detail">查看</a>
|
||||
|
||||
<a class="layui-btn" lay-event="agent_order">查看区域订单</a>
|
||||
<a class="layui-btn" lay-event="remove">移除代理</a>
|
||||
|
||||
</div>
|
||||
|
|
@ -150,7 +151,7 @@
|
|||
field: 'fenxiao_name',
|
||||
title: '代理名称',
|
||||
unresize: 'false',
|
||||
width: '8%'
|
||||
width: '12%'
|
||||
},{
|
||||
templet: function(data) {
|
||||
var html = ""
|
||||
|
|
@ -166,7 +167,7 @@
|
|||
field: 'parent_name',
|
||||
title: '推荐人',
|
||||
unresize: 'false',
|
||||
width: '5%',
|
||||
width: '10%',
|
||||
templet: function(data) {
|
||||
if(data.parent_name){
|
||||
return data.parent_name;
|
||||
|
|
@ -179,6 +180,22 @@
|
|||
title: '代理等级',
|
||||
unresize: 'false',
|
||||
width: '10%'
|
||||
},{
|
||||
field: 'agent_level_name',
|
||||
title: '代理区域',
|
||||
unresize: 'false',
|
||||
width: '20%',
|
||||
templet: function(data) {
|
||||
if(data.agent_level_id == 1){
|
||||
return data.province_name
|
||||
}
|
||||
if(data.agent_level_id == 2){
|
||||
return data.province_name + '-' + data.city_name
|
||||
}
|
||||
if(data.agent_level_id == 3){
|
||||
return data.province_name + '-' + data.city_name + '-' + data.district_name
|
||||
}
|
||||
}
|
||||
},
|
||||
// {
|
||||
// field: 'total_order_money',
|
||||
|
|
@ -218,7 +235,7 @@
|
|||
field: 'create_time',
|
||||
title: '添加时间',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
width: '12%',
|
||||
templet: function(data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
|
|
@ -254,6 +271,17 @@
|
|||
case 'detail': //查看
|
||||
location.href = ns.url('fenxiao://shop/fenxiao/detail', {'fenxiao_id': data.fenxiao_id})
|
||||
break;
|
||||
case 'agent_order': //查看
|
||||
if(data.agent_level_id == 1){
|
||||
location.href = ns.url('fenxiao://shop/order/lists.html#!search_text_type=order_no&province_id='+data.province_id+'&page=1')
|
||||
}
|
||||
if(data.agent_level_id == 2){
|
||||
location.href = ns.url('fenxiao://shop/order/lists.html#!search_text_type=order_no&province_id='+data.province_id+'&city_id='+data.city_id+'&page=1')
|
||||
}
|
||||
if(data.agent_level_id == 3){
|
||||
location.href = location.origin + '/fenxiao/shop/order/lists.html#!search_text_type=order_no&province_id='+data.province_id+'&city_id='+data.city_id+'&district_id='+data.district_id+'&page=1'
|
||||
}
|
||||
break;
|
||||
case 'remove': //冻结
|
||||
layer.confirm('确定要移除该账户吗?', function () {
|
||||
if (repeat_flag) return;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,28 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">区域筛选:</label>
|
||||
<div class="layui-input-inline ns-len-mid area-select">
|
||||
<select name="province_id" lay-filter="province_id" lay-verify="province_id">
|
||||
<option value="">请选择省份</option>
|
||||
{foreach $province_list as $k => $v}
|
||||
<option value="{$v.id}">{$v.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-input-inline ns-len-mid area-select">
|
||||
<select name="city_id" lay-filter="city_id" lay-verify="city_id">
|
||||
<option value="">请选择城市</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-input-inline ns-len-mid area-select">
|
||||
<select name="district_id" lay-filter="district_id" lay-verify="district_id">
|
||||
<option value="">请选择区/县</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="search">筛选</button>
|
||||
|
|
@ -72,11 +94,30 @@
|
|||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
<script type="text/javascript" src="SHOP_JS/address.js"></script>
|
||||
<script src="FENXIAO_JS/order_list.js"></script>
|
||||
<script>
|
||||
var laypage,element, form, hash_url;
|
||||
var is_refresh = false;
|
||||
var orderDataAll = [];
|
||||
const getQuery = (str) => {
|
||||
// str为?之后的参数部分字符串
|
||||
// const str = url.substr(url.indexOf('?') + 1)
|
||||
// arr每个元素都是完整的参数键值
|
||||
const arr = str.split('&')
|
||||
// result为存储参数键值的集合
|
||||
const result = {}
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
// item的两个元素分别为参数名和参数值
|
||||
const item = arr[i].split('=')
|
||||
result[item[0]] = item[1]
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
let query = getQuery(ns.urlReplace(location.hash.replace('#!', '')));
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*通过hash获取页数
|
||||
|
|
@ -135,6 +176,19 @@
|
|||
element = layui.element;
|
||||
var laydate = layui.laydate;
|
||||
form.render();
|
||||
|
||||
if(query.province_id != 0){
|
||||
$('select[name=province_id]').val(query.province_id);
|
||||
getAreaList(query.province_id, 2);
|
||||
}
|
||||
if(query.province_id != 0){
|
||||
$('select[name=city_id]').val(query.city_id);
|
||||
getAreaList(query.city_id, 3);
|
||||
}
|
||||
if(query.province_id != 0){
|
||||
$('select[name=district_id]').val(query.district_id);
|
||||
getAreaList(query.district_id, 4);
|
||||
}
|
||||
|
||||
//渲染时间
|
||||
laydate.render({
|
||||
|
|
|
|||
|
|
@ -87,6 +87,11 @@ class Memberwithdraw extends BaseApi
|
|||
$account_number = isset($this->params[ 'account_number' ]) ? $this->params[ 'account_number' ] : '';//账号名称
|
||||
$mobile = isset($this->params[ 'mobile' ]) ? $this->params[ 'mobile' ] : '';//手机号
|
||||
$app_type = $this->params[ 'app_type' ];
|
||||
|
||||
if($apply_money % 100 != 0){
|
||||
return $this->response($this->error('','提现金额需为100的整数倍'));
|
||||
}
|
||||
|
||||
$member_model = new MemberModel();
|
||||
$member_info = $member_model->getMemberInfo([ [ 'member_id', '=', $token[ 'data' ][ 'member_id' ] ] ], 'site_id');
|
||||
$withdraw_model = new WithdrawModel();
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ class Task extends Controller
|
|||
Cache::set("cron_last_load_time", time());
|
||||
$cron_model = new \app\model\system\Cron();
|
||||
$cron_model->execute();
|
||||
sleep(60);
|
||||
$url = url('cron/task/execute');
|
||||
http($url, 1);
|
||||
// sleep(60);
|
||||
// $url = url('cron/task/execute');
|
||||
// http($url, 1);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ class MemberAccount extends BaseModel
|
|||
$from_type[ 'point' ][ 'day_settlement' ] = [ 'type_name' => '每日转换', 'type_url' => '' ];
|
||||
$from_type[ 'balance_money' ][ 'day_settlement' ] = [ 'type_name' => '每日转换', 'type_url' => '' ];
|
||||
$from_type[ 'balance_money' ][ 'area' ] = [ 'type_name' => '区域代理结算', 'type_url' => '' ];
|
||||
$from_type[ 'balance_money' ][ 'goufang_to_balance' ] = [ 'type_name' => '购房券转换', 'type_url' => '' ];
|
||||
|
||||
$this->from_type = $from_type;
|
||||
}
|
||||
|
|
@ -170,7 +171,7 @@ class MemberAccount extends BaseModel
|
|||
model('member_account')->rollback();
|
||||
$msg = '';
|
||||
if ($account_type == 'balance') {
|
||||
$msg = '账户余额不足';
|
||||
$msg = '账户消费券不足';
|
||||
} elseif ($account_type == 'point') {
|
||||
$msg = '账户积分不足';
|
||||
} elseif ($account_type == 'growth') {
|
||||
|
|
|
|||
|
|
@ -103,12 +103,13 @@ class Cron extends BaseModel
|
|||
$this->addCronLog($data_log);
|
||||
return $res;
|
||||
});
|
||||
|
||||
//定义最新的执行时间或错误
|
||||
$event_code = $event_res[ 'code' ] ?? 0;
|
||||
if ($event_code < 0) {
|
||||
Log::write($event_res);
|
||||
continue;
|
||||
}
|
||||
// $event_code = $event_res[ 'code' ] ?? 0;
|
||||
// if ($event_code < 0) {
|
||||
// Log::write($event_res);
|
||||
// continue;
|
||||
// }
|
||||
//循环任务
|
||||
if ($v[ 'type' ] == 2) {
|
||||
$period = $v[ 'period' ] == 0 ? 1 : $v[ 'period' ];
|
||||
|
|
@ -146,8 +147,8 @@ class Cron extends BaseModel
|
|||
public function addCronLog($data)
|
||||
{
|
||||
// 日常不需要添加,调试使用
|
||||
// $data[ 'execute_time' ] = time();
|
||||
// model('cron_log')->add($data);
|
||||
$data[ 'execute_time' ] = time();
|
||||
model('cron_log')->add($data);
|
||||
return $this->success();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -205,9 +205,11 @@
|
|||
align:'right',
|
||||
templet: function (d) {
|
||||
if (d.account_data > 0) {
|
||||
return '+' + (d.account_type = "point" ? parseInt(d.account_data) : d.account_data);
|
||||
// return '+' + (d.account_type = "point" ? parseInt(d.account_data) : d.account_data);
|
||||
return '+' + d.account_data;
|
||||
} else {
|
||||
return d.account_type = "point" ? parseInt(d.account_data) : d.account_data;
|
||||
// return d.account_type = "point" ? parseInt(d.account_data) : d.account_data;
|
||||
return d.account_data;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ return [
|
|||
'password' => '',
|
||||
// 缓存有效期 0表示永久缓存
|
||||
'expire' => 604800,
|
||||
// 缓存前缀
|
||||
'prefix' => 'zyhj_',
|
||||
],
|
||||
// 更多的缓存连接
|
||||
],
|
||||
|
|
|
|||
|
|
@ -2330,7 +2330,7 @@ return [
|
|||
],
|
||||
[
|
||||
'name' => 'MEMBER_WITHDRAW_LIST',
|
||||
'title' => '余额提现',
|
||||
'title' => '消费券提现',
|
||||
'url' => 'shop/memberwithdraw/lists',
|
||||
'is_show' => 1,
|
||||
'picture' => 'app/shop/view/public/img/icon_new/member_withdraw_new.png',
|
||||
|
|
|
|||
Loading…
Reference in New Issue