优化功能

main
home.fengxinyhyl 10 months ago
parent 49637102d3
commit 71259316c3
  1. 2
      app/common/repositories/store/order/StoreOrderCreateRepository.php
  2. 44
      app/common/repositories/user/UserAssetsLogRepository.php
  3. 2
      app/common/repositories/user/UserAssetsRepository.php
  4. 11
      app/controller/admin/store/StoreProduct.php
  5. 18
      app/controller/admin/user/UserExtract.php
  6. 2
      public/mer.html
  7. 2
      public/system.html
  8. 3
      route/admin/accounts.php
  9. 9
      view/admin/src/api/accounts.js
  10. 2
      view/admin/src/views/user/list/index.vue
  11. 20
      view/mer/src/views/product/addProduct/index.vue

@ -39,7 +39,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
{
$uid = $user->uid;
$assets = app(UserAssetsRepository::class)->assets($uid);
$userIntegral = $assets['integral_buy'];
$userIntegral = $assets['integral_buy'] + $assets['integral_withdraw'];
$key = md5(json_encode(compact('cartId', 'takes', 'useCoupon', 'useIntegral', 'addressId'))) . $uid;
//去掉过期的优惠券信息

@ -40,16 +40,16 @@ class UserAssetsLogRepository extends BaseRepository
const INTEGRAL_BUY_SHARE = 2; // '分享奖返佣--复购积分',
const INTEGRAL_WITHDRAW_SERVE = 3; // '服务奖返佣--提现积分',
const INTEGRAL_BUY_SERVE = 4; // '服务奖返佣--复购积分',
const INTEGRAL_WITHDRAW_SEND = 5; // '他人转让--提现积分',
const INTEGRAL_WITHDRAW_GET = 6; // '转让他人--提现积分',
const INTEGRAL_WITHDRAW_SEND = 5; // '转让他人--提现积分',
const INTEGRAL_WITHDRAW_GET = 6; // '他人转让--提现积分',
const INTEGRAL_WITHDRAW_DIAMOND = 7; // '兑换钻石--提现积分',
const INTEGRAL_WITHDRAW_HOT = 8; // '爆单奖--提现积分',
const INTEGRAL_BUY_HOT = 9; // '爆单奖--复购积分',
const INTEGRAL_BUY = 10; // '消费--复购积分',
const INTEGRAL_BUY = 10; // '消费--积分',
const INTEGRAL_WITHDRAW = 11; // '提现--提现积分',
const DIAMOND_SEND = 20; //他人转让
const DIAMOND_GET = 21; //转让他人
const DIAMOND_SEND = 20; //转让他人
const DIAMOND_GET = 21; //他人转让
const DIAMOND_STOCK = 22; //兑换本票
const DIAMOND_INTEGRAL = 23; //积分兑换
const DIAMOND_SHARE = 24; //分享奖返佣
@ -96,16 +96,16 @@ class UserAssetsLogRepository extends BaseRepository
self::INTEGRAL_BUY_SHARE => '分享奖返佣--复购积分',
self::INTEGRAL_WITHDRAW_SERVE => '服务奖返佣--提现积分',
self::INTEGRAL_BUY_SERVE => '服务奖返佣--复购积分',
self::INTEGRAL_WITHDRAW_SEND => '他人转让--提现积分',
self::INTEGRAL_WITHDRAW_GET => '转让他人--提现积分',
self::INTEGRAL_WITHDRAW_SEND => '转让他人--提现积分',
self::INTEGRAL_WITHDRAW_GET => '他人转让--提现积分',
self::INTEGRAL_WITHDRAW_DIAMOND => '兑换钻石--提现积分',
self::INTEGRAL_WITHDRAW_HOT => '爆单奖--提现积分',
self::INTEGRAL_BUY_HOT => '爆单奖--复购积分',
self::INTEGRAL_BUY => '消费--复购积分',
self::INTEGRAL_BUY => '消费--积分',
self::INTEGRAL_WITHDRAW => '提现--提现积分',
self::DIAMOND_SEND => '他人转让',
self::DIAMOND_GET => '转让他人',
self::DIAMOND_SEND => '转让他人',
self::DIAMOND_GET => '他人转让',
self::DIAMOND_STOCK => '兑换本票',
self::DIAMOND_INTEGRAL => '积分兑换',
self::DIAMOND_SHARE => '分享奖返佣',
@ -143,26 +143,38 @@ class UserAssetsLogRepository extends BaseRepository
if ($item) {
$item->status = self::STATUS_REFUND;
$item->save();
$this->userAssetsRepository->updateAssets($orderItem['uid'], $item['ext']);
}
$this->userAssetsRepository->updateAssets($orderItem['uid'], array('integral_buy' => -1 * $item['count']));
}
public function userPayEvent($groupOrder)
{
$assets = $this->userAssetsRepository->assets($groupOrder['uid']);
foreach ($groupOrder['orderList'] as $orderItem) {
// 5. 本人使用的福利积分
if ($orderItem['integral']) {
$updateData = array('integral_buy' => 0, 'integral_withdraw' => 0);
if ($orderItem['integral'] > $assets['integral_buy']) {
$updateData['integral_buy'] = $assets['integral_buy'];
$updateData['integral_withdraw'] = $orderItem['integral'] - $assets['integral_buy'];
} else {
$updateData['integral_buy'] = $orderItem['integral'];
}
$log = array('uid' => $orderItem['uid'],
'asset_type' => self::ASSET_INTEGRAL,
'type' => self::INTEGRAL_BUY,
'status' => self::STATUS_BUY,
'order_id' => $orderItem['order_id'],
'count' => -$orderItem['integral'],
'ext' => $updateData,
);
$this->addLog([$log]);
$this->userAssetsRepository->updateAssets($orderItem['uid'], array('integral_buy' => -$orderItem['integral']));
foreach ($updateData as $key => $value){
$assets[$key] -= $value;
}
$this->userAssetsRepository->updateAssets($orderItem['uid'], $updateData, false);
}
}
}
@ -374,16 +386,16 @@ class UserAssetsLogRepository extends BaseRepository
}
// 计算每个购买当前爆单商品的积分数据
$profit = $productItem['total_price'] - $productItem['cost'] * $productItem['product_num'];
$where = array();
$profit = $productItem['total_price'] - $productItem['cost'] * $productItem['product_num'];
$where = array();
// $where[] = array('product_id', '=', $productItem['product_id']);
$list = $hotRepository->getList($where);
$list = $hotRepository->getList($where);
$logList = array();
foreach ($list as $item) {
$tmp = $this->_getIntegral($profit * $product['hot_integral_rate'] / 100 / count($list));
if ($item['total'] - $item['current'] < $tmp['integral_buy'] + $tmp['integral_withdraw']) {
$tmp = $this->_getIntegral($item['total'] - $item['current']);
$tmp = $this->_getIntegral($item['total'] - $item['current']);
// $item['status'] = 1;
}
$this->userAssetsRepository->updateAssets($item['uid'], $tmp);

@ -222,7 +222,7 @@ class UserAssetsRepository extends BaseRepository
$logList[] = array(
'uid' => $uid,
'asset_type' => UserAssetsLogRepository::ASSET_DIAMOND,
'type' => UserAssetsLogRepository::DIAMOND_DEPOSIT,
'type' => UserAssetsLogRepository::DIAMOND_STOCK,
'status' => UserAssetsLogRepository::STATUS_USE,
'count' => $diamond,
);

@ -12,6 +12,7 @@
namespace app\controller\admin\store;
use app\common\repositories\store\product\ProductAttrValueRepository;
use app\common\repositories\store\product\SpuRepository;
use app\common\repositories\system\merchant\MerchantRepository;
use app\common\repositories\system\operate\OperateLogRepository;
@ -24,6 +25,7 @@ use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\facade\Queue;
use think\facade\Request;
class StoreProduct extends BaseController
{
@ -164,6 +166,15 @@ class StoreProduct extends BaseController
{
$data = $this->checkParams($validate);
$this->repository->adminUpdate($id, $data);
$productAttrRepository = \app(ProductAttrValueRepository::class);
$attrValue = Request::post('attrValue');
if($attrValue){
foreach ($attrValue as $item){
$productAttrRepository->update($item['value_id'], array('price' => $item['price'],'cost' => $item['cost']));
}
}
return app('json')->success('编辑成功');
}

@ -76,6 +76,24 @@ class UserExtract extends BaseController
return app('json')->success('审核成功');
}
/**
* TODO
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-16
*/
public function updateImage($id)
{
$data = $this->request->params(['image']);
if (!$this->repository->getWhereCount($id))
return app('json')->fail('数据不存在或状态错误');
halt($data);
$this->repository->update($id, $data);
return app('json')->success('审核成功');
}
public function export()
{
$where = $this->request->params(['status', 'keyword', 'date', 'extract_type']);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -87,6 +87,9 @@ Route::group(function () {
Route::post('status/:id', 'UserExtract/switchStatus')->name('systemUserExtractSwitchStatus')->option([
'_alias' => '审核',
]);
Route::post('image/:id', 'UserExtract/switchStatus')->name('systemUserExtractSwitchStatus')->option([
'_alias' => '上传凭证',
]);
Route::get('export', 'UserExtract/export')->name('systemUserExtractExport')->option([
'_alias' => '导出',
]);

@ -23,6 +23,13 @@ export function extractStatusApi(id, data) {
return request.post(`user/extract/status/${id}`, data)
}
/**
* @description 提现 -- 审核
*/
export function extractImageApi(id, data) {
return request.post(`user/extract/image/${id}`, data)
}
/**
* @description 充值记录 -- 列表
*/
@ -271,4 +278,4 @@ export function singleMerBillExport(type,data) {
*/
export function singleMerBillHeader(id,data) {
return request.get(`financial_record/mer_title/${id}`, data)
}
}

@ -25,7 +25,7 @@
<el-option value="0" label="否" />
</el-select>
</el-form-item>
<el-form-item label="预存用户:" prop="is_hot">
<el-form-item label="爆单用户:" prop="is_hot">
<el-select v-model="userFrom.is_hot" placeholder="请选择" class="selWidth" clearable filterable @change="changeSearch(1)">
<el-option value="1" label="是" />
<el-option value="0" label="否" />

@ -45,14 +45,14 @@
<!-- </div>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="24">
<el-form-item label="商品类型:" required prop="is_hot">
<el-radio-group v-model="formValidate.is_hot">
<el-radio :label="0" class="radio">普通商品</el-radio>
<el-radio :label="1">爆单商品</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<!-- <el-col :span="24">-->
<!-- <el-form-item label="商品类型:" required prop="is_hot">-->
<!-- <el-radio-group v-model="formValidate.is_hot">-->
<!-- <el-radio :label="0" class="radio">普通商品</el-radio>-->
<!-- <el-radio :label="1">爆单商品</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="24">
<el-form-item label="商品名称:" prop="store_name">
<el-input
@ -1331,7 +1331,7 @@ const defaultObj = {
image: '',
slider_image: [],
store_name: '',
is_hot:0,
// is_hot:'',
store_info: '',
keyword: '',
brand_id: '', // id
@ -2642,7 +2642,7 @@ export default {
attrValue: info.attrValue,
slider_image: info.slider_image,
store_name: info.store_name,
is_hot: info.is_hot ? info.is_hot :0,
// is_hot: info.is_hot,
store_info: info.store_info,
good_ids: info.good_ids || [],
keyword: info.keyword,

Loading…
Cancel
Save