Browse Source

checkredis

yijia
娄梦宁 4 years ago
parent
commit
82b8474176
8 changed files with 86 additions and 19 deletions
  1. +1
    -1
      addons/unishop/controller/Order.php
  2. +40
    -1
      application/admin/controller/unishop/Order.php
  3. +2
    -0
      application/admin/controller/unishop/Product.php
  4. +2
    -1
      application/admin/view/unishop/order/index.html
  5. +8
    -8
      application/admin/view/unishop/product/add.html
  6. +6
    -6
      application/admin/view/unishop/product/edit.html
  7. +1
    -1
      application/api/controller/Index.php
  8. +26
    -1
      public/assets/js/backend/unishop/order.js

+ 1
- 1
addons/unishop/controller/Order.php View File

@@ -242,7 +242,7 @@ class Order extends Base
$list = collection($list)->toArray();
$product = new \app\admin\model\unishop\Product();
foreach ($list as $val){
$product->where(["id"=>$val['product_id']])->setInc("stock",$val["number"]);
$product->where(["id"=>$val['product_id']])->setInc("stock",$val["number"])->setInc("real_sales",-$val["number"]);
}

if ($order['status'] == \addons\unishop\model\Order::STATUS_NORMAL && $order['have_paid'] == \addons\unishop\model\Order::PAID_NO) {


+ 40
- 1
application/admin/controller/unishop/Order.php View File

@@ -82,6 +82,7 @@ class Order extends Backend
$item['have_delivered_status'] = $item['have_delivered'];
$item['have_received_status'] = $item['have_received'];
$item['have_commented_status'] = $item['have_commented'];
$item["is_carry"]=$item["is_carry"]?"已提货":"未提货";
}
$result = array("total" => $total, "rows" => $list);
return json($result);
@@ -601,6 +602,35 @@ class Order extends Backend
}
$row++;
}
$title2=["商品名称","总库存","剩余库存"];

$sheet_three= $spreadsheet->createSheet(3)->setTitle('库存信息');
foreach ($title2 as $key => $value) {
// 单元格内容写入
$sheet_three->setCellValueByColumnAndRow($key + 1, 1, $value);
}
$product1=new \addons\unishop\model\Product();
$product_list1 = $product1
->field('
id,
title,
(stock+real_sales),
stock')
->select();
$product_list1 = collection($product_list1)->toArray();
$row=2;
foreach ($product_list1 as $tmp_product){
unset($tmp_product["product_id"]);
$column = 1;
foreach ($tmp_product as $value) {
// 单元格内容写入
$sheet_three->setCellValueByColumnAndRow($column, $row, $value);
$column++;
}
$row++;

}


$file_name="导出订单.xlsx";
// Redirect output to a client’s web browser (Xlsx)
@@ -685,7 +715,16 @@ class Order extends Backend
$list = collection($order)->toArray();
$product = new \app\admin\model\unishop\Product();
foreach ($list as $val){
$product->where(["id"=>$val['product_id']])->setInc("stock",$val["number"]);
$product->where(["id"=>$val['product_id']])->setInc("stock",$val["number"])->setInc("real_sales",-$val["number"]);
}
}

public function carry($ids = null)
{
$this->model->save(
['is_carry'=>1],
['id'=>["in",$ids]]
);
$this->success("确认成功", null);
}
}

+ 2
- 0
application/admin/controller/unishop/Product.php View File

@@ -54,6 +54,7 @@ class Product extends Backend
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
$params[$this->dataLimitField] = $this->auth->id;
}
$params['category_id']=78;
$result = false;
Db::startTrans();
try {
@@ -158,6 +159,7 @@ class Product extends Backend
if ($params) {
$params = $this->preExcludeFields($params);
$result = false;
$params['category_id']=78;
Db::startTrans();
try {
//是否采用模型验证


+ 2
- 1
application/admin/view/unishop/order/index.html View File

@@ -20,8 +20,9 @@
<!-- <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('unishop/order/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('unishop/order/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('unishop/order/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<a href="javascript:;" class="btn btn-success btn-carry btn-disabled disabled title="{:__('确认提货')}" ><i class="fa fa-trash"></i> {:__('确认提货')}</a>
<a href="javascript:;" class="btn btn-success btn-export title="{:__('导出')}" ><i class="fa fa-export"></i> {:__('导出')}</a>
<a href="javascript:;" class="btn btn-success btn-finish title="{:__('完成订单')}" ><i class="fa fa-export"></i> {:__('完成订单')}</a>
<!-- <a href="javascript:;" class="btn btn-success btn-finish title="{:__('完成订单')}" ><i class="fa fa-export"></i> {:__('完成订单')}</a>-->
<!-- <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('unishop/order/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->

<!-- <div class="dropdown btn-group {:$auth->check('unishop/order/multi')?'':'hide'}">-->


+ 8
- 8
application/admin/view/unishop/product/add.html View File

@@ -5,14 +5,14 @@
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-category_id" data-rule="required" data-source="unishop/category/index"
data-params='{"custom[type]":"product"}' class="form-control selectpage" name="row[category_id]"
type="text" value="">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-category_id" data-rule="required" data-source="unishop/category/index"-->
<!-- data-params='{"custom[type]":"product"}' class="form-control selectpage" name="row[category_id]"-->
<!-- type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">


+ 6
- 6
application/admin/view/unishop/product/edit.html View File

@@ -5,12 +5,12 @@
</style>
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>
<div class="col-xs-12 col-sm-8">
{$categoryList}
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- {$categoryList}-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">


+ 1
- 1
application/api/controller/Index.php View File

@@ -46,7 +46,7 @@ class Index extends Api
$list = collection($list)->toArray();
$product = new \app\admin\model\unishop\Product();
foreach ($list as $val){
$product->where(["id"=>$val['product_id']])->setInc("stock",$val["number"]);
$product->where(["id"=>$val['product_id']])->setInc("stock",$val["number"])->setInc("real_sales",-$val["number"]);
}
$model->save(["status"=>0],["id"=>["in",$ids]]);
}


+ 26
- 1
public/assets/js/backend/unishop/order.js View File

@@ -26,6 +26,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
index_url: 'unishop/order/index' + location.search,
add_url: 'unishop/order/add',
edit_url: 'unishop/order/edit',
carry_url: 'unishop/order/carry',
del_url: 'unishop/order/del',
multi_url: 'unishop/order/multi',
delivere_url: 'unishop/order/delivery',
@@ -97,6 +98,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'user.nickname', title: __('名字'),visible:false,operate: 'LIKE'},
{field: 'out_trade_no', title: __('Out_trade_no'),operate:false},
{field: 'order_price', title: __('Order_price'), operate:false},
{field: 'is_carry', title: __('是否提货'), operate:false},
// {field: 'discount_price', title: __('Discount_price'), operate:'BETWEEN'},
// {field: 'delivery_price', title: __('Delivery_price'), operate:'BETWEEN'},
{field: 'total_price', title: __('Total_price'), operate:false},
@@ -164,7 +166,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// 为表格绑定事件
Table.api.bindevent(table);
$(document).on("click", ".btn-export", function () {
window.location.href="order/export"
window.location.href="order/export";
});
$(document).on("click", ".btn-finish", function () {
Layer.confirm(
@@ -182,6 +184,25 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
);
});

$(document).on("click", ".btn-carry", function () {
var ids = Table.api.selectedids(table);
Layer.confirm(
__('确定要提货吗?'),
{icon: 3, title: __('Warning'), offset: 0, shadeClose: true},
function (index) {
Fast.api.ajax({
url:"unishop/order/carry",
loading:false,
data:{"ids":ids}
}, function(data, ret){
//成功回调
Layer.close(index);
// layer.msg('操作成功!');
});
}
);
});
},
recyclebin: function () {
// 初始化表格参数配置
@@ -270,6 +291,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
edit: function () {
Controller.api.bindevent();
},
carry: function () {
console(1);
Controller.api.bindevent();
},
delivery: function(){
Controller.api.bindevent();
},


Loading…
Cancel
Save