Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
service
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
aimeiyue
service
Commits
dabb409e
Commit
dabb409e
authored
Sep 26, 2024
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
d82c7217
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
90 additions
and
106 deletions
+90
-106
app/Admin/Controllers/GoodController.php
+8
-17
app/Admin/Controllers/IncomeController.php
+5
-0
app/Admin/Controllers/MerchantController.php
+10
-5
app/Admin/Controllers/MerchantGoodsStoreController.php
+1
-1
app/Admin/Forms/CheckIncome.php
+23
-13
app/Http/Controllers/Api/IncomeController.php
+1
-0
app/Http/Controllers/Api/SystemSettingController.php
+3
-3
app/Models/Pay.php
+17
-0
app/Store/Controllers/HomeController.php
+2
-2
app/Store/Controllers/MerchatGoodsStoreController.php
+13
-60
app/Store/Controllers/OrderInfoController.php
+2
-1
app/Store/Controllers/StoreIncomeController.php
+2
-1
app/Store/Metrics/Examples/LastPickupTotal.php
+1
-1
app/Store/Metrics/Examples/LastProductOrders.php
+1
-1
app/Store/Metrics/Examples/LastWaitPickTotal.php
+1
-1
No files found.
app/Admin/Controllers/GoodController.php
View file @
dabb409e
...
@@ -157,14 +157,14 @@ protected function form()
...
@@ -157,14 +157,14 @@ protected function form()
->
maxSize
(
4096
)
->
maxSize
(
4096
)
->
url
(
'upload/goods'
)
->
url
(
'upload/goods'
)
->
help
(
'仅支持jpg、jpeg、png格式图片上传(320px * 320px)'
)
->
help
(
'仅支持jpg、jpeg、png格式图片上传(320px * 320px)'
)
->
autoUpload
()
->
required
()
;
->
autoUpload
();
$form
->
multipleImage
(
'carousel'
,
'产品图'
)
$form
->
multipleImage
(
'carousel'
,
'产品图'
)
->
accept
(
'jpg,jpeg,png'
)
->
accept
(
'jpg,jpeg,png'
)
->
maxSize
(
51200
)
->
maxSize
(
51200
)
->
url
(
'upload/goods'
)
->
url
(
'upload/goods'
)
->
help
(
'仅支持jpg、jpeg、png格式图片上传(尺寸 750px*750px)'
)
->
help
(
'仅支持jpg、jpeg、png格式图片上传(尺寸 750px*750px)'
)
->
limit
(
5
)
->
limit
(
5
)
->
autoUpload
()
->
saveAsJson
()
->
required
()
;
->
autoUpload
()
->
saveAsJson
();
$form
->
switch
(
'is_show'
,
'上架状态'
)
->
default
(
1
);
$form
->
switch
(
'is_show'
,
'上架状态'
)
->
default
(
1
);
$form
->
switch
(
'is_hot'
,
'是否推荐'
)
->
default
(
0
);
$form
->
switch
(
'is_hot'
,
'是否推荐'
)
->
default
(
0
);
$form
->
text
(
'sort'
,
'排序'
)
->
default
(
0
)
->
help
(
'越大越靠前'
);
$form
->
text
(
'sort'
,
'排序'
)
->
default
(
0
)
->
help
(
'越大越靠前'
);
...
@@ -195,22 +195,13 @@ protected function form()
...
@@ -195,22 +195,13 @@ protected function form()
'field3'
=>
''
,
'field3'
=>
''
,
'field4'
=>
''
,
'field4'
=>
''
,
'field5'
=>
''
,
'field5'
=>
''
,
'field6'
=>
''
,
'field7'
=>
''
,
'field8'
=>
''
,
'field9'
=>
''
,
'field10'
=>
''
,
'field11'
=>
''
,
'field12'
=>
''
,
'field13'
=>
''
,
'field14'
=>
''
,
'field15'
=>
''
,
'field16'
=>
''
,
];
];
$form
->
keyValue
(
'tags'
,
'标签'
)
->
default
(
$fieldArr
)
$form
->
keyValue
(
'tags'
,
'标签'
)
->
setKeyLabel
(
'键 (field开头拼上数字,商品列表页filed1-9,商品详情页field10-19)'
)
->
setKeyLabel
(
'键 (field开头拼上数字,商品列表页filed1-10,商品详情页field11-30)'
)
->
setValueLabel
(
'值'
)
->
setValueLabel
(
'值'
)
->
saving
(
function
(
$v
)
{
;
// 转化为json格式存储
return
json_encode
(
$v
);
});
//->disableCreateButton();
//->disableCreateButton();
//->disableDelete();
//->disableDelete();
})
->
tab
(
'详情'
,
function
(
Form
$form
)
{
})
->
tab
(
'详情'
,
function
(
Form
$form
)
{
...
...
app/Admin/Controllers/IncomeController.php
View file @
dabb409e
...
@@ -21,6 +21,7 @@ class IncomeController extends AdminController
...
@@ -21,6 +21,7 @@ class IncomeController extends AdminController
protected
function
grid
()
protected
function
grid
()
{
{
return
Grid
::
make
(
new
Income
(),
function
(
Grid
$grid
)
{
return
Grid
::
make
(
new
Income
(),
function
(
Grid
$grid
)
{
$grid
->
model
()
->
orderBy
(
'created_at'
,
'DESC'
);
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'id'
)
->
sortable
();
//$grid->column('merchant.name', '商户名称');
//$grid->column('merchant.name', '商户名称');
$grid
->
column
(
'user_type'
,
'提现类型'
)
->
using
(
Income
::
USER_TYPE
,
''
);
$grid
->
column
(
'user_type'
,
'提现类型'
)
->
using
(
Income
::
USER_TYPE
,
''
);
...
@@ -55,10 +56,14 @@ protected function grid()
...
@@ -55,10 +56,14 @@ protected function grid()
$grid
->
disableCreateButton
();
$grid
->
disableCreateButton
();
$grid
->
disableActions
();
$grid
->
disableActions
();
$grid
->
disableRowSelector
();
$grid
->
disableRowSelector
();
$grid
->
selector
(
function
(
Grid\Tools\Selector
$selector
)
{
$selector
->
selectOne
(
'status'
,
'状态'
,
Income
::
STATUS
);
});
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
// 更改为 panel 布局
// 更改为 panel 布局
$filter
->
panel
();
$filter
->
panel
();
$filter
->
like
(
'phone'
,
'手机号'
)
->
width
(
4
);
$filter
->
like
(
'phone'
,
'手机号'
)
->
width
(
4
);
$filter
->
equal
(
'status'
,
'提现类型'
)
->
select
(
Income
::
USER_TYPE
)
->
width
(
3
);
$filter
->
between
(
'created_at'
,
'提现时间'
)
->
datetime
()
->
width
(
4
);
$filter
->
between
(
'created_at'
,
'提现时间'
)
->
datetime
()
->
width
(
4
);
});
});
});
});
...
...
app/Admin/Controllers/MerchantController.php
View file @
dabb409e
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
use
App\Admin\Renderable\StoreList
;
use
App\Admin\Renderable\StoreList
;
use
App\Models\StoreAdminUsers
;
class
MerchantController
extends
AdminController
class
MerchantController
extends
AdminController
{
{
...
@@ -22,6 +23,7 @@ class MerchantController extends AdminController
...
@@ -22,6 +23,7 @@ class MerchantController extends AdminController
protected
function
grid
()
protected
function
grid
()
{
{
return
Grid
::
make
(
new
Merchant
(),
function
(
Grid
$grid
)
{
return
Grid
::
make
(
new
Merchant
(),
function
(
Grid
$grid
)
{
$grid
->
model
()
->
orderBy
(
'created_at'
,
'DESC'
);
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'name'
);
$grid
->
column
(
'name'
);
$grid
->
column
(
'cityinfo'
,
'所在省市'
)
->
display
(
function
(
$val
)
{
$grid
->
column
(
'cityinfo'
,
'所在省市'
)
->
display
(
function
(
$val
)
{
...
@@ -84,7 +86,7 @@ protected function form()
...
@@ -84,7 +86,7 @@ protected function form()
$form
->
text
(
'name'
)
->
required
();
$form
->
text
(
'name'
)
->
required
();
$form
->
text
(
'contacts'
,
'联系人'
);
$form
->
text
(
'contacts'
,
'联系人'
);
$form
->
text
(
'phone'
);
$form
->
text
(
'phone'
);
$form
->
text
(
'account'
);
$form
->
text
(
'account'
)
->
required
()
;
$form
->
text
(
'pwd'
)
->
help
(
'字母数字组合,长度大于5个字符'
);
$form
->
text
(
'pwd'
)
->
help
(
'字母数字组合,长度大于5个字符'
);
$form
->
select
(
'province_id'
,
'省份'
)
->
options
(
City
::
where
(
'parent_id'
,
0
)
->
get
()
->
pluck
(
'name'
,
'city_id'
))
->
rules
(
'required'
)
->
load
(
'city_id'
,
'/city'
);
$form
->
select
(
'province_id'
,
'省份'
)
->
options
(
City
::
where
(
'parent_id'
,
0
)
->
get
()
->
pluck
(
'name'
,
'city_id'
))
->
rules
(
'required'
)
->
load
(
'city_id'
,
'/city'
);
// 城市
// 城市
...
@@ -117,14 +119,16 @@ protected function form()
...
@@ -117,14 +119,16 @@ protected function form()
$form
->
saved
(
$form
->
saved
(
function
(
Form
$form
,
$result
)
{
function
(
Form
$form
,
$result
)
{
$merchant_id
=
$form
->
getKey
();
$merchant_id
=
$form
->
getKey
();
$account
=
$form
->
model
()
->
account
;
$account
=
isset
(
$_POST
[
'account'
])
?
trim
(
$_POST
[
'account'
])
:
''
;
$pwd
=
$form
->
model
()
->
pwd
??
'123456'
;
$pwd
=
isset
(
$_POST
[
'pwd'
])
?
trim
(
$_POST
[
'pwd'
])
:
'123456'
;
//生成商城后台账号
//生成商城后台账号
$admin_users
=
DB
::
table
(
'store_admin_users'
)
->
where
(
"username"
,
$account
)
->
first
();
$admin_users
=
StoreAdminUsers
::
where
(
"username"
,
$account
)
->
first
();
$time
=
time
();
$time
=
time
();
if
(
!
$admin_users
)
{
if
(
!
$admin_users
)
{
if
(
$account
)
{
$storeAdmin_id
=
DB
::
table
(
'store_admin_users'
)
->
insertGetId
(
$storeAdmin_id
=
DB
::
table
(
'store_admin_users'
)
->
insertGetId
(
[
'username'
=>
$account
,
'password'
=>
bcrypt
(
$pwd
),
'name'
=>
$account
,
'created_at'
=>
date
(
'Y-m-d H:i:s'
,
$time
),
'updated_at'
=>
date
(
'Y-m-d H:i:s'
,
$time
)]
[
'username'
=>
$account
,
'password'
=>
bcrypt
(
$pwd
),
'name'
=>
$account
,
'merchant_id'
=>
$merchant_id
,
'created_at'
=>
date
(
'Y-m-d H:i:s'
,
$time
),
'updated_at'
=>
date
(
'Y-m-d H:i:s'
,
$time
)]
);
);
DB
::
table
(
'store_admin_role_users'
)
->
insert
([
DB
::
table
(
'store_admin_role_users'
)
->
insert
([
'role_id'
=>
1
,
'role_id'
=>
1
,
...
@@ -132,6 +136,7 @@ function (Form $form, $result) {
...
@@ -132,6 +136,7 @@ function (Form $form, $result) {
'created_at'
=>
date
(
'Y-m-d H:i:s'
,
$time
),
'created_at'
=>
date
(
'Y-m-d H:i:s'
,
$time
),
'updated_at'
=>
date
(
'Y-m-d H:i:s'
,
$time
)
'updated_at'
=>
date
(
'Y-m-d H:i:s'
,
$time
)
]);
]);
}
}
else
{
}
else
{
$storeAdmin_id
=
$admin_users
->
id
;
$storeAdmin_id
=
$admin_users
->
id
;
if
(
$pwd
!=
'123456'
)
{
//更新密码
if
(
$pwd
!=
'123456'
)
{
//更新密码
...
...
app/Admin/Controllers/MerchantGoodsStoreController.php
View file @
dabb409e
...
@@ -48,7 +48,7 @@ protected function grid()
...
@@ -48,7 +48,7 @@ protected function grid()
//$grid->column('updated_at')->sortable();
//$grid->column('updated_at')->sortable();
$grid
->
disableViewButton
();
$grid
->
disableViewButton
();
$grid
->
disableCreateButton
();
//
$grid->disableCreateButton();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
// 更改为 panel 布局
// 更改为 panel 布局
...
...
app/Admin/Forms/CheckIncome.php
View file @
dabb409e
...
@@ -8,10 +8,13 @@
...
@@ -8,10 +8,13 @@
use
App\Models\Company
;
use
App\Models\Company
;
use
App\Models\Employee
;
use
App\Models\Employee
;
use
App\Models\Income
;
use
App\Models\Income
;
use
App\Models\Merchant
;
use
App\Models\Pay
;
use
App\Models\Pay
;
use
App\Models\User
;
use
Dcat\Admin\Widgets\Form
;
use
Dcat\Admin\Widgets\Form
;
use
Dcat\Admin\Contracts\LazyRenderable
;
use
Dcat\Admin\Contracts\LazyRenderable
;
use
Dcat\Admin\Traits\LazyWidget
;
use
Dcat\Admin\Traits\LazyWidget
;
use
Exception
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
...
@@ -43,21 +46,27 @@ public function handle(array $input)
...
@@ -43,21 +46,27 @@ public function handle(array $input)
$income
->
out_batch_no
=
$pay_res
[
1
];
$income
->
out_batch_no
=
$pay_res
[
1
];
$income
->
batch_id
=
$pay_res
[
2
];
$income
->
batch_id
=
$pay_res
[
2
];
$income
->
batch_status
=
$pay_res
[
3
];
$income
->
batch_status
=
$pay_res
[
3
];
//更新余额
if
(
$income
->
user_type
==
1
)
{
//用户
$uObj
=
User
::
find
(
$income
->
um_id
);
if
(
$uObj
->
balance
>=
$income
->
amount
)
{
$uObj
->
balance
-=
$income
->
amount
;
$uObj
->
save
();
}
else
{
throw
new
Exception
(
'用户余额不足!'
);
}
}
elseif
(
$income
->
user_type
==
2
)
{
//商户
$mObj
=
Merchant
::
find
(
$income
->
um_id
);
if
(
$mObj
->
balance
>=
$income
->
amount
)
{
$mObj
->
balance
-=
$income
->
amount
;
$mObj
->
save
();
}
else
{
throw
new
Exception
(
'商户余额不足!'
);
}
}
}
}
}
elseif
(
$status
==
2
)
{
}
elseif
(
$status
==
2
)
{
$income
->
status
=
2
;
$income
->
status
=
2
;
//恢复陪诊员余额
if
(
$income
->
user_type
==
1
)
{
$em
=
Employee
::
find
(
$income
->
ec_id
);
$em
->
balance
+=
$income
->
amount
;
$em
->
freeze_balance
-=
$income
->
amount
;
$em
->
save
();
}
else
if
(
$income
->
user_type
==
2
)
{
$cm
=
Company
::
find
(
$income
->
ec_id
);
$cm
->
balance
+=
$income
->
amount
;
$cm
->
freeze_balance
-=
$income
->
amount
;
$cm
->
save
();
}
}
}
$income
->
save
();
$income
->
save
();
...
@@ -68,7 +77,7 @@ public function handle(array $input)
...
@@ -68,7 +77,7 @@ public function handle(array $input)
DB
::
rollBack
();
DB
::
rollBack
();
Log
::
add
(
'用户提现失败'
,
$exception
->
getMessage
());
Log
::
add
(
'用户提现失败'
,
$exception
->
getMessage
());
return
$this
->
response
()
->
error
(
'用户提现失败'
)
->
refresh
();
return
$this
->
response
()
->
error
(
$exception
->
getMessage
()
)
->
refresh
();
}
}
return
$this
->
response
()
->
success
(
'用户提现已受理'
)
->
refresh
();
return
$this
->
response
()
->
success
(
'用户提现已受理'
)
->
refresh
();
}
}
...
@@ -129,6 +138,7 @@ public function form()
...
@@ -129,6 +138,7 @@ public function form()
$form
->
textarea
(
'remark'
,
'拒绝理由'
);
$form
->
textarea
(
'remark'
,
'拒绝理由'
);
})
})
->
required
();
->
required
();
$this
->
text
(
'remark'
,
'备注'
);
}
}
/**
/**
...
...
app/Http/Controllers/Api/IncomeController.php
View file @
dabb409e
...
@@ -65,6 +65,7 @@ public function add(Request $request)
...
@@ -65,6 +65,7 @@ public function add(Request $request)
$comObj
->
user_type
=
$type
;
$comObj
->
user_type
=
$type
;
$comObj
->
um_id
=
$useObj
->
id
;
$comObj
->
um_id
=
$useObj
->
id
;
$comObj
->
openid
=
$useObj
->
openid
;
$comObj
->
amount
=
$money
;
$comObj
->
amount
=
$money
;
$comObj
->
status
=
0
;
$comObj
->
status
=
0
;
$comObj
->
save
();
$comObj
->
save
();
...
...
app/Http/Controllers/Api/SystemSettingController.php
View file @
dabb409e
...
@@ -58,8 +58,8 @@ public function qrCode(Request $request)
...
@@ -58,8 +58,8 @@ public function qrCode(Request $request)
$user_id
=
$request
->
user
()
->
id
;
$user_id
=
$request
->
user
()
->
id
;
$writer
=
new
PngWriter
();
$writer
=
new
PngWriter
();
$spurl
=
env
(
"API_URL"
)
.
"/share?
spuid
="
.
$user_id
;
$spurl
=
env
(
"API_URL"
)
.
"/share?
code
="
.
$user_id
;
//$str = "#小程序://留日指南/AYpQ1H8PIFNvUaC";
$qrCode
=
QrCode
::
create
(
$spurl
)
$qrCode
=
QrCode
::
create
(
$spurl
)
->
setEncoding
(
new
Encoding
(
'UTF-8'
))
->
setEncoding
(
new
Encoding
(
'UTF-8'
))
->
setErrorCorrectionLevel
(
new
ErrorCorrectionLevelLow
())
->
setErrorCorrectionLevel
(
new
ErrorCorrectionLevelLow
())
...
@@ -79,7 +79,7 @@ public function qrCode(Request $request)
...
@@ -79,7 +79,7 @@ public function qrCode(Request $request)
mkdir
(
$savePath
,
0755
,
true
);
mkdir
(
$savePath
,
0755
,
true
);
}
}
$result
->
saveToFile
(
$savePath
.
$filename
);
$result
->
saveToFile
(
$savePath
.
$filename
);
$filepath
=
env
(
'
IMAGE_URL'
)
.
$folder_name
.
"/"
.
$filename
;
$filepath
=
env
(
'
API_URL'
)
.
"/uploads"
.
$folder_name
.
"/"
.
$filename
;
//$qrCode->writeFile($savePath);
//$qrCode->writeFile($savePath);
return
$this
->
JsonResponse
([
'qrcode'
=>
$dataUri
,
'filepath'
=>
$filepath
]);
return
$this
->
JsonResponse
([
'qrcode'
=>
$dataUri
,
'filepath'
=>
$filepath
]);
// 返回二维码图片的Base64编码
// 返回二维码图片的Base64编码
...
...
app/Models/Pay.php
View file @
dabb409e
...
@@ -156,4 +156,21 @@ public static function refundNotify($fields)
...
@@ -156,4 +156,21 @@ public static function refundNotify($fields)
});
});
return
$response
;
return
$response
;
}
}
//提现
public
static
function
toBalance
(
$openid
,
$amount
,
$desc
)
{
$out_batch_no
=
'tx'
.
date
(
'Ymd'
)
.
mt_rand
(
1000
,
9999
);
$partner_trade_no
=
date
(
'YmdHis'
)
.
rand
(
1000
,
9999
);
$pay_v3
=
new
PayV3
();
$res
=
$pay_v3
->
transfer
(
$out_batch_no
,
$partner_trade_no
,
$amount
,
$openid
,
$desc
);
Log
::
add
(
'提现微信返回值'
,
$res
);
if
(
isset
(
$res
[
'batch_id'
]))
{
return
[
$partner_trade_no
,
$out_batch_no
,
$res
[
'batch_id'
],
$res
[
'batch_status'
]];
}
throw
new
\Exception
(
'提现失败'
);
}
}
}
app/Store/Controllers/HomeController.php
View file @
dabb409e
...
@@ -26,7 +26,7 @@ public function index(Content $content)
...
@@ -26,7 +26,7 @@ public function index(Content $content)
// $column->row(new Examples\Revenue());
// $column->row(new Examples\Revenue());
// });
// });
$day
=
date
(
"d"
);
$day
=
date
(
"d"
);
if
(
$day
<
18
)
{
$row
->
column
(
12
,
function
(
Column
$column
)
{
$row
->
column
(
12
,
function
(
Column
$column
)
{
$content
=
"上月数据统计"
;
$content
=
"上月数据统计"
;
$column
->
row
(
new
Card
(
''
,
$content
));
$column
->
row
(
new
Card
(
''
,
$content
));
...
@@ -43,7 +43,7 @@ public function index(Content $content)
...
@@ -43,7 +43,7 @@ public function index(Content $content)
$row
->
column
(
6
,
new
Examples\LastWaitPickTotal
());
$row
->
column
(
6
,
new
Examples\LastWaitPickTotal
());
});
});
});
});
}
$row
->
column
(
12
,
function
(
Column
$column
)
{
$row
->
column
(
12
,
function
(
Column
$column
)
{
$content
=
"本月数据统计"
;
$content
=
"本月数据统计"
;
...
...
app/Store/Controllers/MerchatGoodsStoreController.php
View file @
dabb409e
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
App\Store\Controllers
;
namespace
App\Store\Controllers
;
use
App\Models\MerchantStore
;
use
App\Models\MerchantStore
;
use
App\Models\MerchantGoodSku
;
use
App\Admin\Renderable\MerchantStoreSkuList
;
use
App\Admin\Renderable\MerchantStoreSkuList
;
use
App\Models\Good
;
use
App\Models\Good
;
use
App\Models\StoreGoodsCategory
;
use
App\Models\StoreGoodsCategory
;
...
@@ -24,16 +25,22 @@ protected function grid()
...
@@ -24,16 +25,22 @@ protected function grid()
{
{
return
Grid
::
make
(
MerchantStore
::
with
([
'goods'
,
'merchant'
]),
function
(
Grid
$grid
)
{
return
Grid
::
make
(
MerchantStore
::
with
([
'goods'
,
'merchant'
]),
function
(
Grid
$grid
)
{
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
model
()
->
where
([
'merchant_id'
=>
Admin
::
user
()
->
id
])
->
orderBy
(
'created_at'
,
'DESC'
);
$merchant_id
=
Admin
::
user
()
->
merchant_id
;
$grid
->
model
()
->
where
([
'merchant_id'
=>
$merchant_id
])
->
orderBy
(
'created_at'
,
'DESC'
);
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'goods_sn'
,
'商品编号'
);
$grid
->
column
(
'goods_sn'
,
'商品编号'
);
$grid
->
column
(
'goods.cover_img'
,
'商品图片'
)
->
image
(
''
,
100
,
100
);
$grid
->
column
(
'goods.cover_img'
,
'商品图片'
)
->
image
(
env
(
'IMAGE_URL'
)
,
100
,
100
);
$grid
->
column
(
'goods.goods_name'
,
'商品名称'
);
$grid
->
column
(
'goods.goods_name'
,
'商品名称'
);
$grid
->
column
(
'attr'
,
'商品规格'
)
->
expand
(
function
(
Grid\Displayers\Expand
$expand
)
{
$grid
->
column
(
'attr'
,
'商品规格'
)
->
expand
(
function
(
Grid\Displayers\Expand
$expand
)
{
$expand
->
button
(
'查看'
);
$expand
->
button
(
'查看'
);
return
MerchantStoreSkuList
::
make
([
'mgs_id'
=>
$this
->
id
]);
return
MerchantStoreSkuList
::
make
([
'mgs_id'
=>
$this
->
id
]);
})
->
width
(
100
);
})
->
width
(
100
);
$grid
->
column
(
'store'
,
'库存'
);
$grid
->
column
(
'store'
,
'库存'
)
->
display
(
function
(
$val
)
use
(
$merchant_id
)
{
$mgsId
=
$this
->
id
;
$gid
=
$this
->
goods_id
;
$stock
=
MerchantGoodSku
::
where
([
'mgs_id'
=>
$mgsId
,
'merchant_id'
=>
$merchant_id
,
'goods_id'
=>
$gid
])
->
sum
(
'stock'
);
return
$stock
;
});
$grid
->
setDialogFormDimensions
(
'70%'
,
'90%'
);
$grid
->
setDialogFormDimensions
(
'70%'
,
'90%'
);
$grid
->
enableDialogCreate
();
$grid
->
enableDialogCreate
();
...
@@ -42,6 +49,7 @@ protected function grid()
...
@@ -42,6 +49,7 @@ protected function grid()
$grid
->
disableEditButton
();
$grid
->
disableEditButton
();
$grid
->
disableViewButton
();
$grid
->
disableViewButton
();
$grid
->
disableActions
();
$grid
->
disableActions
();
$grid
->
disableRowSelector
();
// $grid->simplePaginate();
// $grid->simplePaginate();
$grid
->
disableFilterButton
();
$grid
->
disableFilterButton
();
$grid
->
quickSearch
(
'goods.goods_name'
)
->
placeholder
(
'搜索商品'
);
$grid
->
quickSearch
(
'goods.goods_name'
)
->
placeholder
(
'搜索商品'
);
...
@@ -58,67 +66,12 @@ protected function grid()
...
@@ -58,67 +66,12 @@ protected function grid()
*
*
* @return Show
* @return Show
*/
*/
protected
function
detail
(
$id
)
protected
function
detail
(
$id
)
{}
{
return
Show
::
make
(
$id
,
new
StoreGood
(),
function
(
Show
$show
)
{
$show
->
field
(
'id'
);
$show
->
field
(
'title'
);
$show
->
field
(
'tags'
);
$show
->
field
(
'price'
);
$show
->
field
(
'sale_price'
);
$show
->
field
(
'small_cover'
);
$show
->
field
(
'cover'
);
$show
->
field
(
'category_id'
);
$show
->
field
(
'intro'
);
$show
->
field
(
'look_num'
);
$show
->
field
(
'inventory'
);
$show
->
field
(
'created_at'
);
$show
->
field
(
'updated_at'
);
});
}
/**
/**
* Make a form builder.
* Make a form builder.
*
*
* @return Form
* @return Form
*/
*/
protected
function
form
()
protected
function
form
()
{}
{
return
Form
::
make
(
new
StoreGood
(),
function
(
Form
$form
)
{
if
(
$form
->
isCreating
())
{
$form
->
hidden
(
'store_id'
)
->
value
(
Admin
::
user
()
->
id
);
}
$form
->
text
(
'title'
);
$form
->
multipleSelect
(
'tags'
)
->
options
(
StoreGoodsTag
::
where
([
'store_id'
=>
Admin
::
user
()
->
id
])
->
get
()
->
pluck
(
'title'
,
'id'
))
->
saving
(
function
(
$value
)
{
return
$value
?
json_encode
(
$value
)
:
null
;
});
$form
->
currency
(
'price'
)
->
symbol
(
'¥'
);
$form
->
currency
(
'sale_price'
)
->
symbol
(
'¥'
);
$form
->
image
(
'small_cover'
)
->
accept
(
'jpg,jpeg,png'
)
->
maxSize
(
4096
)
->
url
(
'upload/store'
)
->
help
(
'仅支持jpg、jpeg、png格式图片上传'
)
->
autoUpload
();
$form
->
image
(
'cover'
)
->
accept
(
'jpg,jpeg,png'
)
->
maxSize
(
4096
)
->
url
(
'upload/store'
)
->
help
(
'仅支持jpg、jpeg、png格式图片上传'
)
->
autoUpload
();
$form
->
select
(
'category_id'
)
->
options
(
StoreGoodsCategory
::
where
([
'store_id'
=>
Admin
::
user
()
->
id
])
->
get
()
->
pluck
(
'title'
,
'id'
))
->
default
(
0
)
->
required
();
$form
->
editor
(
'intro'
)
->
imageUrl
(
'upload/store'
)
->
height
(
400
);
$form
->
number
(
'inventory'
);
$form
->
disableDeleteButton
();
$form
->
disableEditingCheck
();
$form
->
disableViewButton
();
$form
->
disableViewCheck
();
$form
->
disableCreatingCheck
();
});
}
}
}
app/Store/Controllers/OrderInfoController.php
View file @
dabb409e
...
@@ -30,7 +30,8 @@ protected function grid()
...
@@ -30,7 +30,8 @@ protected function grid()
{
{
return
Grid
::
make
(
new
OrderInfo
(),
function
(
Grid
$grid
)
{
return
Grid
::
make
(
new
OrderInfo
(),
function
(
Grid
$grid
)
{
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
model
()
->
where
([
'merchant_id'
=>
Admin
::
user
()
->
id
])
->
orderBy
(
'created_at'
,
'DESC'
);
$merchant_id
=
Admin
::
user
()
->
merchant_id
;
$grid
->
model
()
->
where
([
'merchant_id'
=>
$merchant_id
])
->
orderBy
(
'created_at'
,
'DESC'
);
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'order_sn'
,
'订单号'
);
$grid
->
column
(
'order_sn'
,
'订单号'
);
$grid
->
column
(
'mobile'
,
'手机号'
);
$grid
->
column
(
'mobile'
,
'手机号'
);
...
...
app/Store/Controllers/StoreIncomeController.php
View file @
dabb409e
...
@@ -23,7 +23,8 @@ protected function grid()
...
@@ -23,7 +23,8 @@ protected function grid()
return
Grid
::
make
(
new
Income
(),
function
(
Grid
$grid
)
{
return
Grid
::
make
(
new
Income
(),
function
(
Grid
$grid
)
{
//$grid->tools(new IncomeApply());
//$grid->tools(new IncomeApply());
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
model
()
->
where
([
'user_type'
=>
2
,
'um_id'
=>
Admin
::
user
()
->
id
])
->
orderBy
(
'created_at'
,
'DESC'
);
$merchant_id
=
Admin
::
user
()
->
merchant_id
;
$grid
->
model
()
->
where
([
'user_type'
=>
2
,
'um_id'
=>
$merchant_id
])
->
orderBy
(
'created_at'
,
'DESC'
);
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'amount'
,
'金额'
);
$grid
->
column
(
'amount'
,
'金额'
);
$grid
->
column
(
'status'
)
->
using
(
Income
::
STATUS
)
->
dot
([
$grid
->
column
(
'status'
)
->
using
(
Income
::
STATUS
)
->
dot
([
...
...
app/Store/Metrics/Examples/LastPickupTotal.php
View file @
dabb409e
...
@@ -45,7 +45,7 @@ public function handle(Request $request)
...
@@ -45,7 +45,7 @@ public function handle(Request $request)
$started
=
date
(
'Y-m-01'
,
strtotime
(
'last month'
));
$started
=
date
(
'Y-m-01'
,
strtotime
(
'last month'
));
$ended
=
date
(
'Y-m-t'
,
strtotime
(
'last month'
));
$ended
=
date
(
'Y-m-t'
,
strtotime
(
'last month'
));
$order_status
=
[
3
,
4
];
$order_status
=
[
3
,
4
];
$count
=
OrderInfoModel
::
getNumDa
yDa
ta
(
$started
,
$ended
,
$order_status
,
Admin
::
user
()
->
id
);
$count
=
OrderInfoModel
::
getNumData
(
$started
,
$ended
,
$order_status
,
Admin
::
user
()
->
id
);
// 卡片内容
// 卡片内容
$this
->
withContent
(
$count
);
$this
->
withContent
(
$count
);
...
...
app/Store/Metrics/Examples/LastProductOrders.php
View file @
dabb409e
...
@@ -50,7 +50,7 @@ public function handle(Request $request)
...
@@ -50,7 +50,7 @@ public function handle(Request $request)
//上月
//上月
$started
=
date
(
'Y-m-01'
,
strtotime
(
'last month'
));
$started
=
date
(
'Y-m-01'
,
strtotime
(
'last month'
));
$ended
=
date
(
'Y-m-t'
,
strtotime
(
'last month'
));
$ended
=
date
(
'Y-m-t'
,
strtotime
(
'last month'
));
$count
=
OrderInfoModel
::
getNumDa
yDa
ta
(
$started
,
$ended
,
[
2
],
Admin
::
user
()
->
id
);
$count
=
OrderInfoModel
::
getNumData
(
$started
,
$ended
,
[
2
],
Admin
::
user
()
->
id
);
// 卡片内容
// 卡片内容
$this
->
withContent
(
$count
);
$this
->
withContent
(
$count
);
// 图表数据
// 图表数据
...
...
app/Store/Metrics/Examples/LastWaitPickTotal.php
View file @
dabb409e
...
@@ -44,7 +44,7 @@ public function handle(Request $request)
...
@@ -44,7 +44,7 @@ public function handle(Request $request)
$started
=
date
(
'Y-m-01'
,
strtotime
(
'last month'
));
$started
=
date
(
'Y-m-01'
,
strtotime
(
'last month'
));
$ended
=
date
(
'Y-m-t'
,
strtotime
(
'last month'
));
$ended
=
date
(
'Y-m-t'
,
strtotime
(
'last month'
));
$order_status
=
[
2
];
$order_status
=
[
2
];
$count
=
OrderInfoModel
::
getNumDa
yDa
ta
(
$started
,
$ended
,
$order_status
,
Admin
::
user
()
->
id
);
$count
=
OrderInfoModel
::
getNumData
(
$started
,
$ended
,
$order_status
,
Admin
::
user
()
->
id
);
// 卡片内容
// 卡片内容
$this
->
withContent
(
$count
);
$this
->
withContent
(
$count
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment