|
@@ -35,6 +35,7 @@ class Programme extends Api
|
|
|
*@ApiReturnParams (name=total,description=预估报价)
|
|
|
* @ApiReturnParams (name=num,description=采购数量)
|
|
|
* @ApiReturnParams (name=num_install,description=安装数量)
|
|
|
+ * @ApiReturnParams (name=category_id,description=商品分类id)
|
|
|
*/
|
|
|
public function calculate(){
|
|
|
$sku = input('sku');
|
|
@@ -54,6 +55,7 @@ class Programme extends Api
|
|
|
$goods[$k]['name'] = $nowGoods['name'];
|
|
|
$goods[$k]['sku'] = $goodsSku['name'];
|
|
|
$goods[$k]['num'] = $v['num'];
|
|
|
+ $goods[$k]['category_id'] = $nowGoods['category_id'];
|
|
|
$goods[$k]['num_install'] = $v['num_install'];
|
|
|
$goods[$k]['amount'] = $goodsSku['amount'];//单价
|
|
|
$goods[$k]['amount_install']=InstallService::getFee([$k=>$v]);//安装费
|
|
@@ -188,4 +190,33 @@ class Programme extends Api
|
|
|
$this->success('删除成功');
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 方案详情
|
|
|
+ * @ApiParams (name=id,description=方案id)
|
|
|
+ * ApiReturnParams (name=goods_id,description=商品id)
|
|
|
+ * ApiReturnParams (name=logo,description=logo)
|
|
|
+ * ApiReturnParams (name=name,description=商品名称)
|
|
|
+ * @ApiReturnParams (name=sku,description=规格)
|
|
|
+ * @ApiReturnParams (name=amount,description=单价)
|
|
|
+ * @ApiReturnParams (name=amount_install,description=安装费)
|
|
|
+ * ApiReturnParams (name=createtime,description=创建时间)
|
|
|
+ */
|
|
|
+ public function info(){
|
|
|
+ $id = input('id');
|
|
|
+ $goods = Db('ProgrammeGoods')->where('programme_id',$id)->select();
|
|
|
+ $goodsIds = Db('ProgrammeGoods')->where('programme_id',$id)->column('goods_id');
|
|
|
+ $left = [];
|
|
|
+ foreach ($goodsIds as $k=>$v){
|
|
|
+ $nowGoods = Db('ProgrammeGoods')->where('goods_id',$v)->where('programme_id',$id)->find();
|
|
|
+ $categoryId = Db('Goods')->where('id',$v)->value('category_id');
|
|
|
+ $cate = DB('category')->field('id,name')->where('id',$categoryId)->find();
|
|
|
+ if(empty($left[$cate['id']])){
|
|
|
+ $left[$cate['id']] = $cate;
|
|
|
+ }
|
|
|
+ array_push($left[$cate['id']],$nowGoods);
|
|
|
+ }
|
|
|
+ $left = array_values($left);
|
|
|
+ dump($left);
|
|
|
+ }
|
|
|
+
|
|
|
}
|