作者 何书鹏

定制风格

正在显示 39 个修改的文件 包含 455 行增加502 行删除
@@ -85,25 +85,25 @@ class Goods extends Backend @@ -85,25 +85,25 @@ class Goods extends Backend
85 /** 85 /**
86 * 模特款 86 * 模特款
87 */ 87 */
88 - public function spec($ids = null) 88 + public function style($ids = null)
89 { 89 {
90 $row = $this->model->get($ids); 90 $row = $this->model->get($ids);
91 if (!$row) { 91 if (!$row) {
92 $this->error(__('No Results were found')); 92 $this->error(__('No Results were found'));
93 } 93 }
94 - $goods_spec = new \app\common\model\GoodsSpec; 94 + $goods_style = new \app\common\model\GoodsStyle;
95 if ($this->request->isPost()) { 95 if ($this->request->isPost()) {
96 $params = $this->request->post("row/a"); 96 $params = $this->request->post("row/a");
97 if ($params) { 97 if ($params) {
98 $params = $this->preExcludeFields($params); 98 $params = $this->preExcludeFields($params);
99 - if(empty($params['goods_spec'])){ 99 + if(empty($params['goods_style'])){
100 $this->error(__('该模板下无规格选项,请在【规格模板管理】里为其添加规格')); 100 $this->error(__('该模板下无规格选项,请在【规格模板管理】里为其添加规格'));
101 } 101 }
102 - $params['goods_spec'] = json_encode($params['goods_spec']); 102 + $params['goods_style'] = json_encode($params['goods_style']);
103 $params['goods_id'] = $ids; 103 $params['goods_id'] = $ids;
104 try { 104 try {
105 - $goods_spec->where(['goods_id'=>$ids])->delete();  
106 - $result = $goods_spec->allowField(true)->save($params); 105 + $goods_style->where(['goods_id'=>$ids])->delete();
  106 + $result = $goods_style->allowField(true)->save($params);
107 if ($result !== false) { 107 if ($result !== false) {
108 $this->success(); 108 $this->success();
109 } else { 109 } else {
@@ -117,31 +117,21 @@ class Goods extends Backend @@ -117,31 +117,21 @@ class Goods extends Backend
117 } 117 }
118 $this->error(__('Parameter %s can not be empty', '')); 118 $this->error(__('Parameter %s can not be empty', ''));
119 } 119 }
120 - $spec_template_list = \app\admin\model\SpecTemplate::where('id','>',2)->field('id,name')->select();  
121 - $goods_spec = $goods_spec->get(['goods_id'=>$ids]);  
122 - $this->view->assign('spec_template_list',$spec_template_list);  
123 - $this->view->assign('goods_spec',$goods_spec);  
124 - $this->assignconfig('goods_spec',!empty($goods_spec['goods_spec']) ? json_decode($goods_spec['goods_spec'],true) : []); 120 + $style_template_list = \app\admin\model\StyleTemplate::where('id','>',2)->field('id,name')->select();
  121 + $goods_style = $goods_style->get(['goods_id'=>$ids]);
  122 + $this->view->assign('style_template_list',$style_template_list);
  123 + $this->view->assign('goods_style',$goods_style);
  124 + $this->assignconfig('goods_style',!empty($goods_style['goods_style']) ? json_decode($goods_style['goods_style'],true) : []);
125 return $this->view->fetch(); 125 return $this->view->fetch();
126 } 126 }
127 127
128 /** 128 /**
129 * 正常显示规格 129 * 正常显示规格
130 */ 130 */
131 - public function specList() 131 + public function styleList()
132 { 132 {
133 - $spec_template_id = $this->request->request('spec_template_id');  
134 - $list = \app\common\model\Spec::specList($spec_template_id);  
135 - $this->success(__('成功'),null,compact('list'));  
136 - }  
137 -  
138 - /**  
139 - * 规格值下规格  
140 - */  
141 - public function valueSpecList()  
142 - {  
143 - $spec_value_id = $this->request->request('spec_value_id');  
144 - $list = \app\common\model\Spec::valueSpecList($spec_value_id); 133 + $style_template_id = $this->request->request('style_template_id');
  134 + $list = \app\common\model\Style::styleList($style_template_id);
145 $this->success(__('成功'),null,compact('list')); 135 $this->success(__('成功'),null,compact('list'));
146 } 136 }
147 } 137 }
@@ -6,24 +6,24 @@ use app\common\controller\Backend; @@ -6,24 +6,24 @@ use app\common\controller\Backend;
6 use fast\Tree; 6 use fast\Tree;
7 7
8 /** 8 /**
9 - * 格管理 9 + * 定制风格管理
10 * 10 *
11 * @icon fa fa-circle-o 11 * @icon fa fa-circle-o
12 */ 12 */
13 -class Spec extends Backend 13 +class Style extends Backend
14 { 14 {
15 15
16 /** 16 /**
17 - * Spec模型对象  
18 - * @var \app\admin\model\Spec 17 + * Style模型对象
  18 + * @var \app\admin\model\Style
19 */ 19 */
20 protected $model = null; 20 protected $model = null;
21 21
22 public function _initialize() 22 public function _initialize()
23 { 23 {
24 parent::_initialize(); 24 parent::_initialize();
25 - $this->model = new \app\admin\model\Spec;  
26 - $this->view->assign("specTypeList", $this->model->getSpecTypeList()); 25 + $this->model = new \app\admin\model\Style;
  26 + $this->view->assign("styleTypeList", $this->model->getStyleTypeList());
27 $this->view->assign("displayModeList", $this->model->getDisplayModeList()); 27 $this->view->assign("displayModeList", $this->model->getDisplayModeList());
28 } 28 }
29 29
@@ -44,20 +44,28 @@ class Spec extends Backend @@ -44,20 +44,28 @@ class Spec extends Backend
44 */ 44 */
45 public function index() 45 public function index()
46 { 46 {
  47 + //当前是否为关联查询
  48 + $this->relationSearch = false;
47 //设置过滤方法 49 //设置过滤方法
48 - $this->request->filter(['strip_tags']);  
49 - if ($this->request->isAjax()) {  
50 - $spec_template_id = $this->request->request("spec_template_id"); 50 + $this->request->filter(['strip_tags', 'trim']);
  51 + if ($this->request->isAjax())
  52 + {
  53 + //如果发送的来源是Selectpage,则转发到Selectpage
  54 + if ($this->request->request('keyField'))
  55 + {
  56 + return $this->selectpage();
  57 + }
  58 + $style_template_id = $this->request->request("style_template_id");
51 $display_mode = $this->request->request("display_mode"); 59 $display_mode = $this->request->request("display_mode");
52 - if($spec_template_id){  
53 - $where['spec_template_id'] = $spec_template_id; 60 + if($style_template_id){
  61 + $where['style_template_id'] = $style_template_id;
54 } 62 }
55 if($display_mode && $display_mode != 'all'){ 63 if($display_mode && $display_mode != 'all'){
56 $where['display_mode'] = $display_mode; 64 $where['display_mode'] = $display_mode;
57 } 65 }
58 $tree = Tree::instance(); 66 $tree = Tree::instance();
59 $tree->init(collection($this->model->where($where)->order('weigh desc,id desc')->select())->toArray(), 'pid'); 67 $tree->init(collection($this->model->where($where)->order('weigh desc,id desc')->select())->toArray(), 'pid');
60 - $list = $tree->getTreeList($tree->getTreeArray(0), 'spec_name'); 68 + $list = $tree->getTreeList($tree->getTreeArray(0), 'style_name');
61 69
62 $total = count($list); 70 $total = count($list);
63 $result = array("total" => $total, "rows" => $list); 71 $result = array("total" => $total, "rows" => $list);
@@ -72,22 +80,23 @@ class Spec extends Backend @@ -72,22 +80,23 @@ class Spec extends Backend
72 */ 80 */
73 public function add() 81 public function add()
74 { 82 {
75 - // 规格模板ID  
76 - $spec_template_id = $this->request->request('spec_template_id');  
77 - // 所属上级规格 83 + // 风格模板ID
  84 + $style_template_id = $this->request->request('style_template_id');
  85 + // 所属上级风格
78 $where = [ 86 $where = [
79 - 'spec_template_id' => $spec_template_id,  
80 - 'spec_type' => '1', 87 + 'style_template_id' => $style_template_id,
  88 + 'style_type' => '1',
  89 + 'display_mode' => '1',
81 'pid' => 0 90 'pid' => 0
82 ]; 91 ];
83 $tree = Tree::instance(); 92 $tree = Tree::instance();
84 $tree->init(collection($this->model->where($where)->order('weigh desc,id desc')->select())->toArray(), 'pid'); 93 $tree->init(collection($this->model->where($where)->order('weigh desc,id desc')->select())->toArray(), 'pid');
85 - $specdata = [0 => ['display_mode' => 'all', 'spec_name' => __('None')]];  
86 - foreach ($tree->getTreeList($tree->getTreeArray(0), 'spec_name') as $k => $v) {  
87 - $specdata[$v['id']] = $v; 94 + $styledata = [0 => ['display_mode' => 'all', 'style_name' => __('None')]];
  95 + foreach ($tree->getTreeList($tree->getTreeArray(0), 'style_name') as $k => $v) {
  96 + $styledata[$v['id']] = $v;
88 } 97 }
89 - $this->view->assign("spec_template_id", $spec_template_id);  
90 - $this->view->assign("parentList", $specdata); 98 + $this->view->assign("style_template_id", $style_template_id);
  99 + $this->view->assign("parentList", $styledata);
91 return parent::add(); 100 return parent::add();
92 } 101 }
93 102
@@ -112,12 +121,12 @@ class Spec extends Backend @@ -112,12 +121,12 @@ class Spec extends Backend
112 $params = $this->preExcludeFields($params); 121 $params = $this->preExcludeFields($params);
113 122
114 if ($params['pid'] != $row['pid']) { 123 if ($params['pid'] != $row['pid']) {
115 - $childrenIds = Tree::instance()->init(collection(\app\common\model\Spec::select())->toArray())->getChildrenIds($row['id'], true); 124 + $childrenIds = Tree::instance()->init(collection(\app\common\model\style::select())->toArray())->getChildrenIds($row['id'], true);
116 if (in_array($params['pid'], $childrenIds)) { 125 if (in_array($params['pid'], $childrenIds)) {
117 $this->error(__('父组别不能是它自己')); 126 $this->error(__('父组别不能是它自己'));
118 } 127 }
119 if (count($childrenIds) > 1) { 128 if (count($childrenIds) > 1) {
120 - $this->error(__('最多二级规格,已有子规格,请勿归到其他规格下')); 129 + $this->error(__('最多二级风格,已有子风格,请勿归到其他风格下'));
121 } 130 }
122 } 131 }
123 132
@@ -142,19 +151,20 @@ class Spec extends Backend @@ -142,19 +151,20 @@ class Spec extends Backend
142 } 151 }
143 $this->error(__('Parameter %s can not be empty', '')); 152 $this->error(__('Parameter %s can not be empty', ''));
144 } 153 }
145 - // 所属上级 154 + // 所属上级
146 $where = [ 155 $where = [
147 - 'spec_template_id' => $row['spec_template_id'],  
148 - 'spec_type' => '1', 156 + 'style_template_id' => $row['style_template_id'],
  157 + 'style_type' => '1',
  158 + 'display_mode' => '1',
149 'pid' => 0 159 'pid' => 0
150 ]; 160 ];
151 $tree = Tree::instance(); 161 $tree = Tree::instance();
152 $tree->init(collection($this->model->where($where)->order('weigh desc,id desc')->select())->toArray(), 'pid'); 162 $tree->init(collection($this->model->where($where)->order('weigh desc,id desc')->select())->toArray(), 'pid');
153 - $specdata = [0 => ['display_mode' => 'all', 'spec_name' => __('None')]];  
154 - foreach ($tree->getTreeList($tree->getTreeArray(0), 'spec_name') as $k => $v) {  
155 - $specdata[$v['id']] = $v; 163 + $styledata = [0 => ['display_mode' => 'all', 'style_name' => __('None')]];
  164 + foreach ($tree->getTreeList($tree->getTreeArray(0), 'style_name') as $k => $v) {
  165 + $styledata[$v['id']] = $v;
156 } 166 }
157 - $this->view->assign("parentList", $specdata); 167 + $this->view->assign("parentList", $styledata);
158 $this->view->assign("row", $row); 168 $this->view->assign("row", $row);
159 return $this->view->fetch(); 169 return $this->view->fetch();
160 } 170 }
@@ -5,23 +5,23 @@ namespace app\admin\controller; @@ -5,23 +5,23 @@ namespace app\admin\controller;
5 use app\common\controller\Backend; 5 use app\common\controller\Backend;
6 6
7 /** 7 /**
8 - * 格模板管理 8 + * 定制风格模板管理
9 * 9 *
10 * @icon fa fa-circle-o 10 * @icon fa fa-circle-o
11 */ 11 */
12 -class SpecTemplate extends Backend 12 +class StyleTemplate extends Backend
13 { 13 {
14 14
15 /** 15 /**
16 - * SpecTemplate模型对象  
17 - * @var \app\admin\model\SpecTemplate 16 + * StyleTemplate模型对象
  17 + * @var \app\admin\model\StyleTemplate
18 */ 18 */
19 protected $model = null; 19 protected $model = null;
20 20
21 public function _initialize() 21 public function _initialize()
22 { 22 {
23 parent::_initialize(); 23 parent::_initialize();
24 - $this->model = new \app\admin\model\SpecTemplate; 24 + $this->model = new \app\admin\model\StyleTemplate;
25 25
26 } 26 }
27 27
@@ -6,23 +6,23 @@ use app\common\controller\Backend; @@ -6,23 +6,23 @@ use app\common\controller\Backend;
6 use fast\Tree; 6 use fast\Tree;
7 7
8 /** 8 /**
9 - * 规格管理 9 + * 定制风格值管理
10 * 10 *
11 * @icon fa fa-circle-o 11 * @icon fa fa-circle-o
12 */ 12 */
13 -class SpecValue extends Backend 13 +class StyleValue extends Backend
14 { 14 {
15 15
16 /** 16 /**
17 - * SpecValue模型对象  
18 - * @var \app\admin\model\SpecValue 17 + * StyleValue模型对象
  18 + * @var \app\admin\model\StyleValue
19 */ 19 */
20 protected $model = null; 20 protected $model = null;
21 21
22 public function _initialize() 22 public function _initialize()
23 { 23 {
24 parent::_initialize(); 24 parent::_initialize();
25 - $this->model = new \app\admin\model\SpecValue; 25 + $this->model = new \app\admin\model\StyleValue;
26 26
27 } 27 }
28 28
@@ -54,20 +54,15 @@ class SpecValue extends Backend @@ -54,20 +54,15 @@ class SpecValue extends Backend
54 { 54 {
55 return $this->selectpage(); 55 return $this->selectpage();
56 } 56 }
57 - $where['spec_id'] = $this->request->request('spec_id',0); 57 + $style_id = $this->request->request("style_id");
58 $total = $this->model 58 $total = $this->model
59 - ->where($where)  
60 - ->order('weigh desc') 59 + ->where('style_id',$style_id)
61 ->count(); 60 ->count();
62 -  
63 $list = $this->model 61 $list = $this->model
64 - ->where($where)  
65 - ->order('weigh desc') 62 + ->where('style_id',$style_id)
66 ->select(); 63 ->select();
67 -  
68 foreach ($list as $row) { 64 foreach ($list as $row) {
69 - $row->visible(['id','spec_value','spec_value_image','spec_value_price','updatetime','weigh']);  
70 - 65 + $row->visible(['id','style_id','style_value_name','style_value_image','style_value_price','updatetime','weigh']);
71 } 66 }
72 $list = collection($list)->toArray(); 67 $list = collection($list)->toArray();
73 $result = array("total" => $total, "rows" => $list); 68 $result = array("total" => $total, "rows" => $list);
@@ -82,7 +77,7 @@ class SpecValue extends Backend @@ -82,7 +77,7 @@ class SpecValue extends Backend
82 */ 77 */
83 public function add() 78 public function add()
84 { 79 {
85 - $spec_id = $this->request->request('spec_id'); 80 + $style_id = $this->request->request('style_id');
86 if ($this->request->isPost()) { 81 if ($this->request->isPost()) {
87 $params = $this->request->post("row/a"); 82 $params = $this->request->post("row/a");
88 if ($params) { 83 if ($params) {
@@ -92,29 +87,29 @@ class SpecValue extends Backend @@ -92,29 +87,29 @@ class SpecValue extends Backend
92 $params[$this->dataLimitField] = $this->auth->id; 87 $params[$this->dataLimitField] = $this->auth->id;
93 } 88 }
94 89
95 - if(!empty($params['spec_ids'])){  
96 - $spec = new \app\common\model\Spec;  
97 - $display_mode = $spec->where('id',$params['spec_id'])->value('display_mode'); 90 + if(!empty($params['style_ids'])){
  91 + $style = new \app\common\model\Style;
  92 + $display_mode = $style->where('id',$params['style_id'])->value('display_mode');
98 if($display_mode == '2'){ 93 if($display_mode == '2'){
99 - $this->error(__('该规格值,不能选择规格值下规格')); 94 + $this->error(__('该风格值为【风格值下显示风格】的值,不能选择【风格值下显示风格】'));
100 } 95 }
101 - $spec_id_arr = explode(',',$params['spec_ids']);  
102 - $parentsIds = Tree::instance()->init(collection($spec->select())->toArray())->getParentsIds($params['spec_id'], true);  
103 - foreach($spec_id_arr as $v){  
104 - // 规格值下规格,不能是所属规格的父规格或所属规格 96 + $style_id_arr = explode(',',$params['style_ids']);
  97 + $parentsIds = Tree::instance()->init(collection($style->select())->toArray())->getParentsIds($params['style_id'], true);
  98 + foreach($style_id_arr as $v){
  99 + // 选项下风格,不能是所属风格的父风格或所属风格
105 if (in_array($v, $parentsIds)) { 100 if (in_array($v, $parentsIds)) {
106 - $this->error(__('规格值下规格,不能是所属规格的父规格或所属规格')); 101 + $this->error(__('风格值下风格,不能是所属风格的父风格或所属风格'));
107 } 102 }
108 - // 规格值下的规格,只能出现在一个地方 103 + // 选项下的风格,只能出现在一个地方
109 $has = $this->model 104 $has = $this->model
110 ->alias('v') 105 ->alias('v')
111 - ->join('spec s','s.id = v.spec_id')  
112 - ->where("FIND_IN_SET('{$v}', v.spec_ids)")  
113 - ->field('v.spec_id,s.spec_name') 106 + ->join('style s','s.id = v.style_id')
  107 + ->where("FIND_IN_SET('{$v}', v.style_ids)")
  108 + ->field('v.style_id,s.style_name')
114 ->find(); 109 ->find();
115 - if($params['spec_id'] != $has['spec_id']){  
116 - $spec_name = $spec->where('id',$v)->value('spec_name');  
117 - $this->error(__($spec_name.' 已被 '.$has['spec_name'].' 下规格值使用')); 110 + if($params['style_id'] != $has['style_id']){
  111 + $style_name = $style->where('id',$v)->value('style_name');
  112 + $this->error(__($style_name.' 已被 '.$has['style_name'].' 下风格值使用'));
118 } 113 }
119 } 114 }
120 } 115 }
@@ -140,8 +135,8 @@ class SpecValue extends Backend @@ -140,8 +135,8 @@ class SpecValue extends Backend
140 } 135 }
141 $this->error(__('Parameter %s can not be empty', '')); 136 $this->error(__('Parameter %s can not be empty', ''));
142 } 137 }
143 - $this->view->assign("spec_id", $spec_id);  
144 - $this->view->assign("spec_template_id", \app\common\model\Spec::where('id',$spec_id)->value('spec_template_id')); 138 + $this->view->assign("style_id", $style_id);
  139 + $this->view->assign("style_template_id", \app\common\model\Style::where('id',$style_id)->value('style_template_id'));
145 return parent::add(); 140 return parent::add();
146 } 141 }
147 142
@@ -165,29 +160,29 @@ class SpecValue extends Backend @@ -165,29 +160,29 @@ class SpecValue extends Backend
165 if ($params) { 160 if ($params) {
166 $params = $this->preExcludeFields($params); 161 $params = $this->preExcludeFields($params);
167 162
168 - if(!empty($params['spec_ids'])){  
169 - $spec = new \app\common\model\Spec;  
170 - $display_mode = $spec->where('id',$params['spec_id'])->value('display_mode'); 163 + if(!empty($params['style_ids'])){
  164 + $style = new \app\common\model\Style;
  165 + $display_mode = $style->where('id',$params['style_id'])->value('display_mode');
171 if($display_mode == '2'){ 166 if($display_mode == '2'){
172 - $this->error(__('该规格值,不能选择规格值下规格')); 167 + $this->error(__('该风格值为【风格值下显示风格】的值,不能选择【风格值下显示风格】'));
173 } 168 }
174 - $spec_id_arr = explode(',',$params['spec_ids']);  
175 - $parentsIds = Tree::instance()->init(collection($spec->select())->toArray())->getParentsIds($params['spec_id'], true);  
176 - foreach($spec_id_arr as $v){  
177 - // 规格值下规格,不能是所属规格的父规格或所属规格 169 + $style_id_arr = explode(',',$params['style_ids']);
  170 + $parentsIds = Tree::instance()->init(collection($style->select())->toArray())->getParentsIds($params['style_id'], true);
  171 + foreach($style_id_arr as $v){
  172 + // 选项下风格,不能是所属风格的父风格或所属风格
178 if (in_array($v, $parentsIds)) { 173 if (in_array($v, $parentsIds)) {
179 - $this->error(__('规格值下规格,不能是所属规格的父规格或所属规格')); 174 + $this->error(__('风格值下风格,不能是所属风格的父风格或所属风格'));
180 } 175 }
181 - // 规格值下的规格,只能出现在一个地方 176 + // 选项下的风格,只能出现在一个地方
182 $has = $this->model 177 $has = $this->model
183 ->alias('v') 178 ->alias('v')
184 - ->join('spec s','s.id = v.spec_id')  
185 - ->where("FIND_IN_SET('{$v}', v.spec_ids) and v.spec_id != {$params['spec_id']}")  
186 - ->field('v.spec_id,s.spec_name') 179 + ->join('style s','s.id = v.style_id')
  180 + ->where("FIND_IN_SET('{$v}', v.style_ids) and v.style_id != {$params['style_id']}")
  181 + ->field('v.style_id,s.style_name')
187 ->find(); 182 ->find();
188 if($has){ 183 if($has){
189 - $spec_name = $spec->where('id',$v)->value('spec_name');  
190 - $this->error(__($spec_name.' 已被 '.$has['spec_name'].' 下规格值使用')); 184 + $style_name = $style->where('id',$v)->value('style_name');
  185 + $this->error(__($style_name.' 已被 '.$has['style_name'].' 下风格值使用'));
191 } 186 }
192 } 187 }
193 } 188 }
@@ -214,7 +209,7 @@ class SpecValue extends Backend @@ -214,7 +209,7 @@ class SpecValue extends Backend
214 $this->error(__('Parameter %s can not be empty', '')); 209 $this->error(__('Parameter %s can not be empty', ''));
215 } 210 }
216 $this->view->assign("row", $row); 211 $this->view->assign("row", $row);
217 - $this->view->assign("spec_template_id", \app\common\model\Spec::where('id',$row['spec_id'])->value('spec_template_id')); 212 + $this->view->assign("style_template_id", \app\common\model\Style::where('id',$row['style_id'])->value('style_template_id'));
218 return $this->view->fetch(); 213 return $this->view->fetch();
219 } 214 }
220 } 215 }
1 -<?php  
2 -  
3 -return [  
4 - 'Spec_template_id' => '规格模板ID',  
5 - 'Pid' => '父ID',  
6 - 'Spec_name' => '规格组名称',  
7 - 'Spec_type' => '规格类型',  
8 - 'Spec_type 1' => '普通',  
9 - 'Spec_type 2' => '文本',  
10 - 'Spec_type 3' => '图片',  
11 - 'Display_mode' => '显示方式',  
12 - 'Display_mode 1' => '正常显示',  
13 - 'Display_mode 2' => '规格值下显示',  
14 - 'Createtime' => '创建时间',  
15 - 'Updatetime' => '更新时间',  
16 - 'Weigh' => '权重'  
17 -];  
1 -<?php  
2 -  
3 -return [  
4 - 'Spec_id' => '规格组ID',  
5 - 'Spec_value' => '规格值',  
6 - 'Spec_value_image' => '规格值图片',  
7 - 'Spec_value_price' => '规格值价格',  
8 - 'Spec_ids' => '规格值下的规格组',  
9 - 'Createtime' => '创建时间',  
10 - 'Updatetime' => '更新时间',  
11 - 'Weigh' => '权重'  
12 -];  
  1 +<?php
  2 +
  3 +return [
  4 + 'Style_template_id' => '定制风格模板ID',
  5 + 'Pid' => '父ID',
  6 + 'Style_name' => '风格名称',
  7 + 'Style_type' => '风格类型',
  8 + 'Style_type 1' => '普通',
  9 + 'Style_type 2' => '文本',
  10 + 'Style_type 3' => '图片',
  11 + 'Display_mode' => '显示方式',
  12 + 'Display_mode 1' => '正常显示',
  13 + 'Display_mode 2' => '风格值下显示',
  14 + 'Createtime' => '创建时间',
  15 + 'Updatetime' => '更新时间',
  16 + 'Weigh' => '权重'
  17 +];
  1 +<?php
  2 +
  3 +return [
  4 + 'Style_id' => '风格ID',
  5 + 'Style_value_name' => '风格值名称',
  6 + 'Style_value_desc' => '风格值描述',
  7 + 'Style_value_image' => '风格值图片',
  8 + 'Style_value_price' => '风格值价格',
  9 + 'Style_ids' => '风格值下的风格',
  10 + 'Createtime' => '创建时间',
  11 + 'Updatetime' => '更新时间',
  12 + 'Weigh' => '权重'
  13 +];
@@ -5,7 +5,7 @@ namespace app\admin\model; @@ -5,7 +5,7 @@ namespace app\admin\model;
5 use think\Model; 5 use think\Model;
6 6
7 7
8 -class Spec extends Model 8 +class Style extends Model
9 { 9 {
10 10
11 11
@@ -13,7 +13,7 @@ class Spec extends Model @@ -13,7 +13,7 @@ class Spec extends Model
13 13
14 14
15 // 表名 15 // 表名
16 - protected $name = 'spec'; 16 + protected $name = 'style';
17 17
18 // 自动写入时间戳字段 18 // 自动写入时间戳字段
19 protected $autoWriteTimestamp = 'int'; 19 protected $autoWriteTimestamp = 'int';
@@ -25,7 +25,7 @@ class Spec extends Model @@ -25,7 +25,7 @@ class Spec extends Model
25 25
26 // 追加属性 26 // 追加属性
27 protected $append = [ 27 protected $append = [
28 - 'spec_type_text', 28 + 'style_type_text',
29 'display_mode_text' 29 'display_mode_text'
30 ]; 30 ];
31 31
@@ -39,9 +39,9 @@ class Spec extends Model @@ -39,9 +39,9 @@ class Spec extends Model
39 } 39 }
40 40
41 41
42 - public function getSpecTypeList() 42 + public function getStyleTypeList()
43 { 43 {
44 - return ['1' => __('Spec_type 1'), '2' => __('Spec_type 2'), '3' => __('Spec_type 3')]; 44 + return ['1' => __('Style_type 1'), '2' => __('Style_type 2'), '3' => __('Style_type 3')];
45 } 45 }
46 46
47 public function getDisplayModeList() 47 public function getDisplayModeList()
@@ -50,10 +50,10 @@ class Spec extends Model @@ -50,10 +50,10 @@ class Spec extends Model
50 } 50 }
51 51
52 52
53 - public function getSpecTypeTextAttr($value, $data) 53 + public function getStyleTypeTextAttr($value, $data)
54 { 54 {
55 - $value = $value ? $value : (isset($data['spec_type']) ? $data['spec_type'] : '');  
56 - $list = $this->getSpecTypeList(); 55 + $value = $value ? $value : (isset($data['style_type']) ? $data['style_type'] : '');
  56 + $list = $this->getStyleTypeList();
57 return isset($list[$value]) ? $list[$value] : ''; 57 return isset($list[$value]) ? $list[$value] : '';
58 } 58 }
59 59
@@ -5,7 +5,7 @@ namespace app\admin\model; @@ -5,7 +5,7 @@ namespace app\admin\model;
5 use think\Model; 5 use think\Model;
6 6
7 7
8 -class SpecTemplate extends Model 8 +class StyleTemplate extends Model
9 { 9 {
10 10
11 11
@@ -13,7 +13,7 @@ class SpecTemplate extends Model @@ -13,7 +13,7 @@ class SpecTemplate extends Model
13 13
14 14
15 // 表名 15 // 表名
16 - protected $name = 'spec_template'; 16 + protected $name = 'style_template';
17 17
18 // 自动写入时间戳字段 18 // 自动写入时间戳字段
19 protected $autoWriteTimestamp = 'int'; 19 protected $autoWriteTimestamp = 'int';
@@ -5,7 +5,7 @@ namespace app\admin\model; @@ -5,7 +5,7 @@ namespace app\admin\model;
5 use think\Model; 5 use think\Model;
6 6
7 7
8 -class SpecValue extends Model 8 +class StyleValue extends Model
9 { 9 {
10 10
11 11
@@ -13,7 +13,7 @@ class SpecValue extends Model @@ -13,7 +13,7 @@ class SpecValue extends Model
13 13
14 14
15 // 表名 15 // 表名
16 - protected $name = 'spec_value'; 16 + protected $name = 'style_value';
17 17
18 // 自动写入时间戳字段 18 // 自动写入时间戳字段
19 protected $autoWriteTimestamp = 'int'; 19 protected $autoWriteTimestamp = 'int';
@@ -4,7 +4,7 @@ namespace app\admin\validate; @@ -4,7 +4,7 @@ namespace app\admin\validate;
4 4
5 use think\Validate; 5 use think\Validate;
6 6
7 -class Spec extends Validate 7 +class Style extends Validate
8 { 8 {
9 /** 9 /**
10 * 验证规则 10 * 验证规则
@@ -4,7 +4,7 @@ namespace app\admin\validate; @@ -4,7 +4,7 @@ namespace app\admin\validate;
4 4
5 use think\Validate; 5 use think\Validate;
6 6
7 -class SpecTemplate extends Validate 7 +class StyleTemplate extends Validate
8 { 8 {
9 /** 9 /**
10 * 验证规则 10 * 验证规则
@@ -4,7 +4,7 @@ namespace app\admin\validate; @@ -4,7 +4,7 @@ namespace app\admin\validate;
4 4
5 use think\Validate; 5 use think\Validate;
6 6
7 -class SpecValue extends Validate 7 +class StyleValue extends Validate
8 { 8 {
9 /** 9 /**
10 * 验证规则 10 * 验证规则
1 -<form id="spec-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">  
2 - <div class="form-group">  
3 - <label class="control-label col-xs-12 col-sm-2">{:__('规格模板')}:</label>  
4 - <div class="col-xs-12 col-sm-8">  
5 - <select id="c-spec_template_id" data-rule="required" class="form-control selectpicker" name="row[spec_template_id]">  
6 - {foreach name="spec_template_list" item="vo"}  
7 - <option value="{$vo.id}" {in name="vo.id" value="$goods_spec['spec_template_id']"}selected{/in}>{$vo.name}</option>  
8 - {/foreach}  
9 - </select>  
10 - </div>  
11 - </div>  
12 - <div class="form-group layer-footer">  
13 - <label class="control-label col-xs-12 col-sm-2"></label>  
14 - <div class="col-xs-12 col-sm-8">  
15 - <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>  
16 - <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>  
17 - </div>  
18 - </div>  
19 -</form>  
1 -<form id="model-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> 1 +<form id="style-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
2 <div class="form-group"> 2 <div class="form-group">
3 - <label class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label> 3 + <label class="control-label col-xs-12 col-sm-2">{:__('定制风格模板')}:</label>
4 <div class="col-xs-12 col-sm-8"> 4 <div class="col-xs-12 col-sm-8">
5 - <input id="c-category_id" data-rule="required" data-source="category/selectpage" data-params='{"custom[type]":"goods","custom[id]":"{$category_id}"}' class="form-control selectpage" name="row[category_id]" type="text" value=""> 5 + <select id="c-style_template_id" data-rule="required" class="form-control selectpicker" name="row[style_template_id]">
  6 + {foreach name="style_template_list" item="vo"}
  7 + <option value="{$vo.id}" {in name="vo.id" value="$goods_style['style_template_id']"}selected{/in}>{$vo.name}</option>
  8 + {/foreach}
  9 + </select>
6 </div> 10 </div>
7 </div> 11 </div>
8 <div class="form-group layer-footer"> 12 <div class="form-group layer-footer">
1 <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> 1 <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
2 2
3 <div class="form-group"> 3 <div class="form-group">
4 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_template_id')}:</label> 4 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_template_id')}:</label>
5 <div class="col-xs-12 col-sm-8"> 5 <div class="col-xs-12 col-sm-8">
6 - <input id="c-spec_template_id" data-rule="required" data-source="spec_template/index" data-params='{"custom[id]":"{$spec_template_id}"}' class="form-control selectpage" name="row[spec_template_id]" type="text" value="{$spec_template_id}"> 6 + <input id="c-style_template_id" data-rule="required" data-source="style_template/index" data-params='{"custom[id]":"{$style_template_id}"}' class="form-control selectpage" name="row[style_template_id]" type="text" value="{$style_template_id}">
7 </div> 7 </div>
8 </div> 8 </div>
9 <div class="form-group"> 9 <div class="form-group">
@@ -11,23 +11,23 @@ @@ -11,23 +11,23 @@
11 <div class="col-xs-12 col-sm-8"> 11 <div class="col-xs-12 col-sm-8">
12 <select id="c-pid" data-rule="required" class="form-control selectpicker" name="row[pid]"> 12 <select id="c-pid" data-rule="required" class="form-control selectpicker" name="row[pid]">
13 {foreach name="parentList" item="vo"} 13 {foreach name="parentList" item="vo"}
14 - <option data-display_mode="{$vo.display_mode}" value="{$key}" {in name="key" value=""}selected{/in}>{$vo.spec_name}</option> 14 + <option data-display_mode="{$vo.display_mode}" value="{$key}" {in name="key" value=""}selected{/in}>{$vo.style_name}</option>
15 {/foreach} 15 {/foreach}
16 </select> 16 </select>
17 </div> 17 </div>
18 </div> 18 </div>
19 <div class="form-group"> 19 <div class="form-group">
20 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_name')}:</label> 20 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_name')}:</label>
21 <div class="col-xs-12 col-sm-8"> 21 <div class="col-xs-12 col-sm-8">
22 - <input id="c-spec_name" data-rule="required" class="form-control" name="row[spec_name]" type="text" value=""> 22 + <input id="c-style_name" data-rule="required" class="form-control" name="row[style_name]" type="text" value="">
23 </div> 23 </div>
24 </div> 24 </div>
25 <div class="form-group"> 25 <div class="form-group">
26 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_type')}:</label> 26 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_type')}:</label>
27 <div class="col-xs-12 col-sm-8"> 27 <div class="col-xs-12 col-sm-8">
28 28
29 - <select id="c-spec_type" data-rule="required" class="form-control selectpicker" name="row[spec_type]">  
30 - {foreach name="specTypeList" item="vo"} 29 + <select id="c-style_type" data-rule="required" class="form-control selectpicker" name="row[style_type]">
  30 + {foreach name="styleTypeList" item="vo"}
31 <option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option> 31 <option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
32 {/foreach} 32 {/foreach}
33 </select> 33 </select>
1 <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> 1 <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
2 2
3 <div class="form-group"> 3 <div class="form-group">
4 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_template_id')}:</label> 4 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_template_id')}:</label>
5 <div class="col-xs-12 col-sm-8"> 5 <div class="col-xs-12 col-sm-8">
6 - <input id="c-spec_template_id" data-rule="required" data-source="spec_template/index" data-params='{"custom[id]":"{$row.spec_template_id}"}' class="form-control selectpage" name="row[spec_template_id]" type="text" value="{$row.spec_template_id|htmlentities}"> 6 + <input id="c-style_template_id" data-rule="required" data-source="style_template/index" data-params='{"custom[id]":"{$row.style_template_id}"}' class="form-control selectpage" name="row[style_template_id]" type="text" value="{$row.style_template_id|htmlentities}">
7 </div> 7 </div>
8 </div> 8 </div>
9 <div class="form-group"> 9 <div class="form-group">
@@ -11,24 +11,24 @@ @@ -11,24 +11,24 @@
11 <div class="col-xs-12 col-sm-8"> 11 <div class="col-xs-12 col-sm-8">
12 <select id="c-pid" data-rule="required" class="form-control selectpicker" name="row[pid]"> 12 <select id="c-pid" data-rule="required" class="form-control selectpicker" name="row[pid]">
13 {foreach name="parentList" item="vo"} 13 {foreach name="parentList" item="vo"}
14 - <option data-display_mode="{$vo.display_mode}" value="{$key}" {in name="key" value="$row.pid"}selected{/in}>{$vo.spec_name}</option> 14 + <option data-display_mode="{$vo.display_mode}" value="{$key}" {in name="key" value="$row.pid"}selected{/in}>{$vo.style_name}</option>
15 {/foreach} 15 {/foreach}
16 </select> 16 </select>
17 </div> 17 </div>
18 </div> 18 </div>
19 <div class="form-group"> 19 <div class="form-group">
20 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_name')}:</label> 20 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_name')}:</label>
21 <div class="col-xs-12 col-sm-8"> 21 <div class="col-xs-12 col-sm-8">
22 - <input id="c-spec_name" data-rule="required" class="form-control" name="row[spec_name]" type="text" value="{$row.spec_name|htmlentities}"> 22 + <input id="c-style_name" data-rule="required" class="form-control" name="row[style_name]" type="text" value="{$row.style_name|htmlentities}">
23 </div> 23 </div>
24 </div> 24 </div>
25 <div class="form-group"> 25 <div class="form-group">
26 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_type')}:</label> 26 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_type')}:</label>
27 <div class="col-xs-12 col-sm-8"> 27 <div class="col-xs-12 col-sm-8">
28 28
29 - <select id="c-spec_type" data-rule="required" class="form-control selectpicker" name="row[spec_type]">  
30 - {foreach name="specTypeList" item="vo"}  
31 - <option value="{$key}" {in name="key" value="$row.spec_type"}selected{/in}>{$vo}</option> 29 + <select id="c-style_type" data-rule="required" class="form-control selectpicker" name="row[style_type]">
  30 + {foreach name="styleTypeList" item="vo"}
  31 + <option value="{$key}" {in name="key" value="$row.style_type"}selected{/in}>{$vo}</option>
32 {/foreach} 32 {/foreach}
33 </select> 33 </select>
34 34
@@ -17,12 +17,12 @@ @@ -17,12 +17,12 @@
17 <div class="widget-body no-padding"> 17 <div class="widget-body no-padding">
18 <div id="toolbar" class="toolbar"> 18 <div id="toolbar" class="toolbar">
19 <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> 19 <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
20 - <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('spec/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>  
21 - <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('spec/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>  
22 - <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('spec/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>  
23 - <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('spec/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> 20 + <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('style/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
  21 + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('style/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
  22 + <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('style/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
  23 + <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('style/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>
24 24
25 - <div class="dropdown btn-group {:$auth->check('spec/multi')?'':'hide'}"> 25 + <div class="dropdown btn-group {:$auth->check('style/multi')?'':'hide'}">
26 <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a> 26 <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
27 <ul class="dropdown-menu text-left" role="menu"> 27 <ul class="dropdown-menu text-left" role="menu">
28 <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li> 28 <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
@@ -33,8 +33,8 @@ @@ -33,8 +33,8 @@
33 33
34 </div> 34 </div>
35 <table id="table" class="table table-striped table-bordered table-hover table-nowrap" 35 <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
36 - data-operate-edit="{:$auth->check('spec/edit')}"  
37 - data-operate-del="{:$auth->check('spec/del')}" 36 + data-operate-edit="{:$auth->check('style/edit')}"
  37 + data-operate-del="{:$auth->check('style/del')}"
38 width="100%"> 38 width="100%">
39 </table> 39 </table>
40 </div> 40 </div>
@@ -7,14 +7,14 @@ @@ -7,14 +7,14 @@
7 <div class="widget-body no-padding"> 7 <div class="widget-body no-padding">
8 <div id="toolbar" class="toolbar"> 8 <div id="toolbar" class="toolbar">
9 <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> 9 <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
10 - <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('spec_template/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>  
11 - <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('spec_template/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> 10 + <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('style_template/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
  11 + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('style_template/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
12 12
13 13
14 </div> 14 </div>
15 <table id="table" class="table table-striped table-bordered table-hover table-nowrap" 15 <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
16 - data-operate-edit="{:$auth->check('spec_template/edit')}"  
17 - data-operate-del="{:$auth->check('spec_template/del')}" 16 + data-operate-edit="{:$auth->check('style_template/edit')}"
  17 + data-operate-del="{:$auth->check('style_template/del')}"
18 width="100%"> 18 width="100%">
19 </table> 19 </table>
20 </div> 20 </div>
1 <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> 1 <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
2 2
3 <div class="form-group"> 3 <div class="form-group">
4 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_id')}:</label> 4 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_id')}:</label>
5 <div class="col-xs-12 col-sm-8"> 5 <div class="col-xs-12 col-sm-8">
6 - <input id="c-spec_id" data-rule="required" data-source="spec/selectpage" data-params='{"custom[id]":"{$spec_id}"}' data-field="spec_name" class="form-control selectpage" name="row[spec_id]" type="text" value="{$spec_id}"> 6 + <input id="c-style_id" data-rule="required" data-source="style/selectpage" data-params='{"custom[id]":"{$style_id}"}' data-field="style_name" class="form-control selectpage" name="row[style_id]" type="text" value="{$style_id}">
7 </div> 7 </div>
8 </div> 8 </div>
9 <div class="form-group"> 9 <div class="form-group">
10 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_value')}:</label> 10 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_value_name')}:</label>
11 <div class="col-xs-12 col-sm-8"> 11 <div class="col-xs-12 col-sm-8">
12 - <input id="c-spec_value" data-rule="required" class="form-control" name="row[spec_value]" type="text" value=""> 12 + <input id="c-style_value_name" data-rule="required" class="form-control" name="row[style_value_name]" type="text" value="">
13 </div> 13 </div>
14 </div> 14 </div>
15 <div class="form-group"> 15 <div class="form-group">
16 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_value_image')}:</label> 16 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_value_desc')}:</label>
17 <div class="col-xs-12 col-sm-8"> 17 <div class="col-xs-12 col-sm-8">
18 - <div class="input-group">  
19 - <input id="c-spec_value_image" class="form-control" size="50" name="row[spec_value_image]" type="text" value="">  
20 - <div class="input-group-addon no-border no-padding">  
21 - <span><button type="button" id="plupload-spec_value_image" class="btn btn-danger plupload" data-input-id="c-spec_value_image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-spec_value_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>  
22 - <span><button type="button" id="fachoose-spec_value_image" class="btn btn-primary fachoose" data-input-id="c-spec_value_image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>  
23 - </div>  
24 - <span class="msg-box n-right" for="c-spec_value_image"></span>  
25 - </div>  
26 - <ul class="row list-inline plupload-preview" id="p-spec_value_image"></ul> 18 + <input id="c-style_value_desc" class="form-control" name="row[style_value_desc]" type="text" value="">
27 </div> 19 </div>
28 </div> 20 </div>
29 <div class="form-group"> 21 <div class="form-group">
30 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_value_price')}:</label> 22 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_value_image')}:</label>
31 <div class="col-xs-12 col-sm-8"> 23 <div class="col-xs-12 col-sm-8">
32 - <input id="c-spec_value_price" data-rule="required" class="form-control" step="0.01" name="row[spec_value_price]" type="number" value="0.00"> 24 + <div class="input-group">
  25 + <input id="c-style_value_image" class="form-control" size="50" name="row[style_value_image]" type="text" value="">
  26 + <div class="input-group-addon no-border no-padding">
  27 + <span><button type="button" id="plupload-style_value_image" class="btn btn-danger plupload" data-input-id="c-style_value_image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-style_value_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  28 + <span><button type="button" id="fachoose-style_value_image" class="btn btn-primary fachoose" data-input-id="c-style_value_image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
  29 + </div>
  30 + <span class="msg-box n-right" for="c-style_value_image"></span>
  31 + </div>
  32 + <ul class="row list-inline plupload-preview" id="p-style_value_image"></ul>
33 </div> 33 </div>
34 </div> 34 </div>
35 <div class="form-group"> 35 <div class="form-group">
36 - <label for="c-spec_value_description" class="control-label col-xs-12 col-sm-2">{:__('规格值描述')}:</label> 36 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_value_price')}:</label>
37 <div class="col-xs-12 col-sm-8"> 37 <div class="col-xs-12 col-sm-8">
38 - <textarea id="c-spec_value_description" class="form-control" name="row[spec_value_description]"></textarea> 38 + <input id="c-style_value_price" data-rule="required" class="form-control" step="0.01" name="row[style_value_price]" type="number" value="0.00">
39 </div> 39 </div>
40 </div> 40 </div>
41 <div class="form-group"> 41 <div class="form-group">
42 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_ids')}:</label> 42 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_ids')}:</label>
43 <div class="col-xs-12 col-sm-8"> 43 <div class="col-xs-12 col-sm-8">
44 - <input id="c-spec_ids" data-source="spec/selectpage" data-params='{"custom[display_mode]":"2","custom[spec_template_id]":"{$spec_template_id}"}' data-field="spec_name" data-multiple="true" class="form-control selectpage" name="row[spec_ids]" type="text" value=""> 44 + <input id="c-style_ids" data-source="style/selectpage" data-params='{"custom[display_mode]":"2","custom[style_template_id]":"{$style_template_id}"}' data-field="style_name" data-multiple="true" class="form-control selectpage" name="row[style_ids]" type="text" value="">
45 </div> 45 </div>
46 </div> 46 </div>
47 <div class="form-group"> 47 <div class="form-group">
1 <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> 1 <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
2 2
3 <div class="form-group"> 3 <div class="form-group">
4 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_id')}:</label> 4 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_id')}:</label>
5 <div class="col-xs-12 col-sm-8"> 5 <div class="col-xs-12 col-sm-8">
6 - <input id="c-spec_id" data-rule="required" data-source="spec/selectpage" data-params='{"custom[id]":"{$row.spec_id}"}' data-field="spec_name" class="form-control selectpage" name="row[spec_id]" type="text" value="{$row.spec_id|htmlentities}"> 6 + <input id="c-style_id" data-rule="required" data-source="style/selectpage" data-params='{"custom[id]":"{$row.style_id}"}' data-field="style_name" class="form-control selectpage" name="row[style_id]" type="text" value="{$row.style_id|htmlentities}">
7 </div> 7 </div>
8 </div> 8 </div>
9 <div class="form-group"> 9 <div class="form-group">
10 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_value')}:</label> 10 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_value_name')}:</label>
11 <div class="col-xs-12 col-sm-8"> 11 <div class="col-xs-12 col-sm-8">
12 - <input id="c-spec_value" data-rule="required" class="form-control" name="row[spec_value]" type="text" value="{$row.spec_value|htmlentities}"> 12 + <input id="c-style_value_name" data-rule="required" class="form-control" name="row[style_value_name]" type="text" value="{$row.style_value_name|htmlentities}">
13 </div> 13 </div>
14 </div> 14 </div>
15 <div class="form-group"> 15 <div class="form-group">
16 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_value_image')}:</label> 16 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_value_desc')}:</label>
17 <div class="col-xs-12 col-sm-8"> 17 <div class="col-xs-12 col-sm-8">
18 - <div class="input-group">  
19 - <input id="c-spec_value_image" class="form-control" size="50" name="row[spec_value_image]" type="text" value="{$row.spec_value_image|htmlentities}">  
20 - <div class="input-group-addon no-border no-padding">  
21 - <span><button type="button" id="plupload-spec_value_image" class="btn btn-danger plupload" data-input-id="c-spec_value_image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-spec_value_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>  
22 - <span><button type="button" id="fachoose-spec_value_image" class="btn btn-primary fachoose" data-input-id="c-spec_value_image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>  
23 - </div>  
24 - <span class="msg-box n-right" for="c-spec_value_image"></span>  
25 - </div>  
26 - <ul class="row list-inline plupload-preview" id="p-spec_value_image"></ul> 18 + <input id="c-style_value_desc" class="form-control" name="row[style_value_desc]" type="text" value="{$row.style_value_desc|htmlentities}">
27 </div> 19 </div>
28 </div> 20 </div>
29 <div class="form-group"> 21 <div class="form-group">
30 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_value_price')}:</label> 22 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_value_image')}:</label>
31 <div class="col-xs-12 col-sm-8"> 23 <div class="col-xs-12 col-sm-8">
32 - <input id="c-spec_value_price" data-rule="required" class="form-control" step="0.01" name="row[spec_value_price]" type="number" value="{$row.spec_value_price|htmlentities}"> 24 + <div class="input-group">
  25 + <input id="c-style_value_image" class="form-control" size="50" name="row[style_value_image]" type="text" value="{$row.style_value_image|htmlentities}">
  26 + <div class="input-group-addon no-border no-padding">
  27 + <span><button type="button" id="plupload-style_value_image" class="btn btn-danger plupload" data-input-id="c-style_value_image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-style_value_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  28 + <span><button type="button" id="fachoose-style_value_image" class="btn btn-primary fachoose" data-input-id="c-style_value_image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
  29 + </div>
  30 + <span class="msg-box n-right" for="c-style_value_image"></span>
  31 + </div>
  32 + <ul class="row list-inline plupload-preview" id="p-style_value_image"></ul>
33 </div> 33 </div>
34 </div> 34 </div>
35 <div class="form-group"> 35 <div class="form-group">
36 - <label for="c-spec_value_description" class="control-label col-xs-12 col-sm-2">{:__('规格值描述')}:</label> 36 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_value_price')}:</label>
37 <div class="col-xs-12 col-sm-8"> 37 <div class="col-xs-12 col-sm-8">
38 - <textarea id="c-spec_value_description" class="form-control" name="row[spec_value_description]">{$row.spec_value_description|htmlentities}</textarea> 38 + <input id="c-style_value_price" data-rule="required" class="form-control" step="0.01" name="row[style_value_price]" type="number" value="{$row.style_value_price|htmlentities}">
39 </div> 39 </div>
40 </div> 40 </div>
41 <div class="form-group"> 41 <div class="form-group">
42 - <label class="control-label col-xs-12 col-sm-2">{:__('Spec_ids')}:</label> 42 + <label class="control-label col-xs-12 col-sm-2">{:__('Style_ids')}:</label>
43 <div class="col-xs-12 col-sm-8"> 43 <div class="col-xs-12 col-sm-8">
44 - <input id="c-spec_ids" data-source="spec/selectpage" data-params='{"custom[display_mode]":"2","custom[spec_template_id]":"{$spec_template_id}"}' data-field="spec_name" data-multiple="true" class="form-control selectpage" name="row[spec_ids]" type="text" value="{$row.spec_ids|htmlentities}"> 44 + <input id="c-style_ids" data-source="style/selectpage" data-params='{"custom[display_mode]":"2","custom[style_template_id]":"{$style_template_id}"}' data-field="style_name" data-multiple="true" class="form-control selectpage" name="row[style_ids]" type="text" value="{$row.style_ids|htmlentities}">
45 </div> 45 </div>
46 </div> 46 </div>
47 <div class="form-group"> 47 <div class="form-group">
@@ -7,12 +7,12 @@ @@ -7,12 +7,12 @@
7 <div class="widget-body no-padding"> 7 <div class="widget-body no-padding">
8 <div id="toolbar" class="toolbar"> 8 <div id="toolbar" class="toolbar">
9 <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> 9 <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
10 - <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('spec_value/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>  
11 - <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('spec_value/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>  
12 - <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('spec_value/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>  
13 - <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('spec_value/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> 10 + <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('style_value/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
  11 + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('style_value/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
  12 + <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('style_value/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
  13 + <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('style_value/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>
14 14
15 - <div class="dropdown btn-group {:$auth->check('spec_value/multi')?'':'hide'}"> 15 + <div class="dropdown btn-group {:$auth->check('style_value/multi')?'':'hide'}">
16 <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a> 16 <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
17 <ul class="dropdown-menu text-left" role="menu"> 17 <ul class="dropdown-menu text-left" role="menu">
18 <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li> 18 <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
@@ -23,8 +23,8 @@ @@ -23,8 +23,8 @@
23 23
24 </div> 24 </div>
25 <table id="table" class="table table-striped table-bordered table-hover table-nowrap" 25 <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
26 - data-operate-edit="{:$auth->check('spec_value/edit')}"  
27 - data-operate-del="{:$auth->check('spec_value/del')}" 26 + data-operate-edit="{:$auth->check('style_value/edit')}"
  27 + data-operate-del="{:$auth->check('style_value/del')}"
28 width="100%"> 28 width="100%">
29 </table> 29 </table>
30 </div> 30 </div>
@@ -4,7 +4,7 @@ namespace app\api\controller; @@ -4,7 +4,7 @@ namespace app\api\controller;
4 4
5 use app\common\controller\Api; 5 use app\common\controller\Api;
6 use app\common\model\Goods; 6 use app\common\model\Goods;
7 -use app\common\model\GoodsSpec; 7 +use app\common\model\GoodsStyle;
8 use app\common\controller\Wechat; 8 use app\common\controller\Wechat;
9 use think\Db; 9 use think\Db;
10 10
@@ -46,7 +46,7 @@ class Cart extends Api @@ -46,7 +46,7 @@ class Cart extends Api
46 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") 46 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
47 * @ApiParams (name="goods_id", type="integer", required=true, description="商品ID") 47 * @ApiParams (name="goods_id", type="integer", required=true, description="商品ID")
48 * @ApiParams (name="goods_num", type="integer", required=true, description="商品数量") 48 * @ApiParams (name="goods_num", type="integer", required=true, description="商品数量")
49 - * @ApiParams (name="goods_spec", type="object", sample="{'1':'11','5':'15','7':'2','14':'25','15':'\/uploads\/20200711\/3689359dcdf1146d234930cae4958110.jpg','13':'21','12':'18'}", description="商品规格 {'规格组ID':'规格值'}") 49 + * @ApiParams (name="goods_style", type="object", sample="{'1':'11','5':'15','7':'2','14':'25','15':'\/uploads\/20200711\/3689359dcdf1146d234930cae4958110.jpg','13':'21','12':'18'}", description="商品规格 {'风格ID':'风格值'}")
50 * @ApiParams (name="user_size_id", type="integer", description="用户尺寸ID") 50 * @ApiParams (name="user_size_id", type="integer", description="用户尺寸ID")
51 * @ApiReturnParams (name="code", type="integer", required=true, sample="0") 51 * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
52 * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") 52 * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
@@ -97,11 +97,11 @@ class Cart extends Api @@ -97,11 +97,11 @@ class Cart extends Api
97 } 97 }
98 98
99 /** 99 /**
100 - * 购物车-修改 100 + * 购物车-修改定制风
101 * @ApiMethod (GET) 101 * @ApiMethod (GET)
102 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") 102 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
103 * @ApiParams (name="cart_id", type="integer", required=true, description="购物车ID") 103 * @ApiParams (name="cart_id", type="integer", required=true, description="购物车ID")
104 - * @ApiParams (name="goods_spec", type="object", required=true, sample="{'1':'11','5':'15','7':'2','14':'25','15':'\/uploads\/20200711\/3689359dcdf1146d234930cae4958110.jpg','13':'21','12':'18'}", description="商品规格 {'规格组ID':'规格值'}") 104 + * @ApiParams (name="goods_style", type="object", required=true, sample="{'1':'11','5':'15','7':'2','14':'25','15':'\/uploads\/20200711\/3689359dcdf1146d234930cae4958110.jpg','13':'21','12':'18'}", description="商品规格 {'风格ID':'规格值'}")
105 * @ApiReturnParams (name="code", type="integer", required=true, sample="0") 105 * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
106 * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") 106 * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
107 * @ApiReturnParams (name="data", type="object", description="扩展数据返回") 107 * @ApiReturnParams (name="data", type="object", description="扩展数据返回")
@@ -110,17 +110,17 @@ class Cart extends Api @@ -110,17 +110,17 @@ class Cart extends Api
110 'msg':'返回成功' 110 'msg':'返回成功'
111 }) 111 })
112 */ 112 */
113 - public function editGoodsSpec(){ 113 + public function editGoodsStyle(){
114 $cart_id = $this->request->request('cart_id',0); 114 $cart_id = $this->request->request('cart_id',0);
115 - $goods_spec = $this->request->request('goods_spec','','htmlspecialchars_decode'); 115 + $goods_style = $this->request->request('goods_style','','htmlspecialchars_decode');
116 $cart = $this->model->get($cart_id); 116 $cart = $this->model->get($cart_id);
117 empty($cart) && $this->error(__('购物车信息不存在')); 117 empty($cart) && $this->error(__('购物车信息不存在'));
118 - empty($goods_spec) && $this->error(__('请选择您的定制信息'));  
119 - $model_spec = GoodsSpec::get(['goods_id'=>$cart['goods_id'],'goods_spec'=>$goods_spec]); 118 + empty($goods_style) && $this->error(__('请选择您的定制信息'));
  119 + $model_spec = GoodsStyle::get(['goods_id'=>$cart['goods_id'],'goods_style'=>$goods_style]);
120 $cart->make_type = !$model_spec ? '2' : '1'; 120 $cart->make_type = !$model_spec ? '2' : '1';
121 - $cart->goods_spec = $goods_spec;  
122 - $goods_spec_arr = json_decode($goods_spec,true);  
123 - $cart->goods_price = $cart['goods']['goods_price'] + array_sum(\app\common\model\SpecValue::where('id','in',$goods_spec_arr)->column('spec_value_price')); 121 + $cart->goods_style = $goods_style;
  122 + $goods_style_arr = json_decode($goods_style,true);
  123 + $cart->goods_price = $cart['goods']['goods_price'] + array_sum(\app\common\model\SpecValue::where('id','in',$goods_style_arr)->column('spec_value_price'));
124 $cart->save(); 124 $cart->save();
125 $this->success(__('成功')); 125 $this->success(__('成功'));
126 } 126 }
@@ -7,7 +7,7 @@ use app\common\model\Banner; @@ -7,7 +7,7 @@ use app\common\model\Banner;
7 use app\common\model\Coupon; 7 use app\common\model\Coupon;
8 use app\common\model\Category; 8 use app\common\model\Category;
9 use app\common\model\Goods; 9 use app\common\model\Goods;
10 -use app\common\model\GoodsSpec; 10 +use app\common\model\GoodsStyle;
11 use app\common\model\UserSize; 11 use app\common\model\UserSize;
12 12
13 13
@@ -158,12 +158,12 @@ class Index extends Api @@ -158,12 +158,12 @@ class Index extends Api
158 $goods = Goods::get($goods_id); 158 $goods = Goods::get($goods_id);
159 empty($goods) && $this->error(__('商品不存在')); 159 empty($goods) && $this->error(__('商品不存在'));
160 $goods['issale'] == '0' && $this->error(__('商品已下架')); 160 $goods['issale'] == '0' && $this->error(__('商品已下架'));
161 - $goods_spec = GoodsSpec::get(['goods_id'=>$goods_id]);  
162 - if($goods_spec){  
163 - $goods['goods_price'] = $goods['goods_price'] + $goods_spec['goods_spec_price'];  
164 - $goods['goods_spec'] = $goods_spec['goods_spec']; 161 + $goods_style = GoodsStyle::get(['goods_id'=>$goods_id]);
  162 + if($goods_style){
  163 + $goods['goods_price'] = $goods['goods_price'] + $goods_style['goods_style_price'];
  164 + $goods['goods_style'] = $goods_style['goods_style'];
165 }else{ 165 }else{
166 - $goods['goods_spec'] = ''; 166 + $goods['goods_style'] = '';
167 } 167 }
168 // 定制项 1模特款 2自定义 168 // 定制项 1模特款 2自定义
169 $goods['make_type'] = '1'; 169 $goods['make_type'] = '1';
@@ -187,7 +187,7 @@ class Index extends Api @@ -187,7 +187,7 @@ class Index extends Api
187 } 187 }
188 188
189 /** 189 /**
190 - * 规格-正常显示规 190 + * 定制风
191 * @ApiMethod (GET) 191 * @ApiMethod (GET)
192 * @ApiParams (name="goods_id", type="integer", required=true, description="商品ID") 192 * @ApiParams (name="goods_id", type="integer", required=true, description="商品ID")
193 * @ApiReturnParams (name="code", type="integer", required=true, sample="0") 193 * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
@@ -198,14 +198,14 @@ class Index extends Api @@ -198,14 +198,14 @@ class Index extends Api
198 'msg':'返回成功' 198 'msg':'返回成功'
199 }) 199 })
200 */ 200 */
201 - public function specList() 201 + public function styleList()
202 { 202 {
203 $goods_id = $this->request->request('goods_id'); 203 $goods_id = $this->request->request('goods_id');
204 $goods = Goods::get($goods_id); 204 $goods = Goods::get($goods_id);
205 empty($goods) && $this->error(__('商品信息不存在')); 205 empty($goods) && $this->error(__('商品信息不存在'));
206 - $goods_spec = GoodsSpec::get(['goods_id'=>$goods_id]);  
207 - empty($goods_spec) && $this->error(__('该商品还未设置模特款'));  
208 - $list = \app\common\model\Spec::specList($goods_spec['spec_template_id']); 206 + $goods_style = GoodsStyle::get(['goods_id'=>$goods_id]);
  207 + empty($goods_style) && $this->error(__('该商品还未设置模特款'));
  208 + $list = \app\common\model\Style::styleList($goods_style['spec_template_id']);
209 $this->success(__('成功'),compact('list')); 209 $this->success(__('成功'),compact('list'));
210 } 210 }
211 } 211 }
@@ -15,7 +15,7 @@ class Cart extends Model @@ -15,7 +15,7 @@ class Cart extends Model
15 15
16 // 追加属性 16 // 追加属性
17 protected $append = [ 17 protected $append = [
18 - 'goods_spec_text' 18 + 'goods_style_text'
19 ]; 19 ];
20 20
21 // 错误提示 21 // 错误提示
@@ -38,17 +38,17 @@ class Cart extends Model @@ -38,17 +38,17 @@ class Cart extends Model
38 /** 38 /**
39 * 定制项详情 39 * 定制项详情
40 */ 40 */
41 - public function getGoodsSpecTextAttr($value,$data){  
42 - $goods_spec_text = [];  
43 - if(!empty($data['goods_spec'])){  
44 - $goods_spec = json_decode(str_replace('\'','"',$data['goods_spec']),true);  
45 - foreach($goods_spec as $k => $v){  
46 - $spec = Spec::where('id',$k)->field('spec_name,spec_type')->find()->toArray();  
47 - $spec['spec_value'] = $spec['spec_type'] == '1' ? SpecValue::where('id',$v)->value('spec_value') : $v;  
48 - $goods_spec_text[] = $spec; 41 + public function getGoodsStyleTextAttr($value,$data){
  42 + $goods_style_text = [];
  43 + if(!empty($data['goods_style'])){
  44 + $goods_style = json_decode(str_replace('\'','"',$data['goods_style']),true);
  45 + foreach($goods_style as $k => $v){
  46 + $style = Style::where('id',$k)->field('style_name,style_type')->find()->toArray();
  47 + $style['style_value_name'] = $style['style_type'] == '1' ? StyleValue::where('id',$v)->value('style_value_name') : $v;
  48 + $goods_style_text[] = $style;
49 } 49 }
50 } 50 }
51 - return $goods_spec_text; 51 + return $goods_style_text;
52 } 52 }
53 53
54 /** 54 /**
@@ -67,26 +67,26 @@ class Cart extends Model @@ -67,26 +67,26 @@ class Cart extends Model
67 $this->setError(__('尺寸信息不存在')); 67 $this->setError(__('尺寸信息不存在'));
68 return false; 68 return false;
69 } 69 }
70 - if(empty($data['goods_spec'])){ 70 + if(empty($data['goods_style'])){
71 $this->setError(__('请选择定制项')); 71 $this->setError(__('请选择定制项'));
72 return false; 72 return false;
73 } 73 }
74 - $data['goods_spec'] = htmlspecialchars_decode($data['goods_spec']);  
75 - $goods_spec = GoodsSpec::get(['goods_spec'=>$data['goods_spec']]);  
76 - if($goods_spec){ 74 + $data['goods_style'] = htmlspecialchars_decode($data['goods_style']);
  75 + $goods_style = GoodsStyle::get(['goods_style'=>$data['goods_style']]);
  76 + if($goods_style){
77 $data['make_type'] = '1'; 77 $data['make_type'] = '1';
78 - $data['goods_price'] = $goods['goods_price'] + $goods_spec['goods_spec_price']; 78 + $data['goods_price'] = $goods['goods_price'] + $goods_style['goods_style_price'];
79 }else{ 79 }else{
80 $data['make_type'] = '2'; 80 $data['make_type'] = '2';
81 - $goods_spec = json_decode($data['goods_spec'],true);  
82 - $data['goods_price'] = $goods['goods_price'] + array_sum(SpecValue::where('id','in',$goods_spec)->column('spec_value_price')); 81 + $goods_style = json_decode($data['goods_style'],true);
  82 + $data['goods_price'] = $goods['goods_price'] + array_sum(StyleValue::where('id','in',$goods_style)->column('style_value_price'));
83 } 83 }
84 }else{ 84 }else{
85 $data['goods_price'] = $goods['goods_price']; 85 $data['goods_price'] = $goods['goods_price'];
86 } 86 }
87 if(empty($data['isbuynow'])){ 87 if(empty($data['isbuynow'])){
88 $cart = $this->get([ 88 $cart = $this->get([
89 - 'goods_spec' => $data['goods_spec'], 89 + 'goods_style' => $data['goods_style'],
90 'user_id' => $user['id'], 90 'user_id' => $user['id'],
91 'goods_id' => $goods['id'], 91 'goods_id' => $goods['id'],
92 'isbuynow' => '0' 92 'isbuynow' => '0'
@@ -129,8 +129,8 @@ class Cart extends Model @@ -129,8 +129,8 @@ class Cart extends Model
129 $cart_list[] = $cart->visible([ 129 $cart_list[] = $cart->visible([
130 'id', 130 'id',
131 'goods_id', 131 'goods_id',
132 - 'goods_spec',  
133 - 'goods_spec_text', 132 + 'goods_style',
  133 + 'goods_style_text',
134 'goods_price', 134 'goods_price',
135 'goods_num', 135 'goods_num',
136 'make_type', 136 'make_type',
@@ -4,7 +4,7 @@ namespace app\common\model; @@ -4,7 +4,7 @@ namespace app\common\model;
4 4
5 use think\Model; 5 use think\Model;
6 6
7 -class GoodsSpec extends Model 7 +class GoodsStyle extends Model
8 { 8 {
9 // 开启自动写入时间戳字段 9 // 开启自动写入时间戳字段
10 protected $autoWriteTimestamp = 'int'; 10 protected $autoWriteTimestamp = 'int';
@@ -13,15 +13,15 @@ class GoodsSpec extends Model @@ -13,15 +13,15 @@ class GoodsSpec extends Model
13 protected $updateTime = 'updatetime'; 13 protected $updateTime = 'updatetime';
14 14
15 protected $append = [ 15 protected $append = [
16 - 'goods_spec_price' 16 + 'goods_style_price'
17 ]; 17 ];
18 18
19 /** 19 /**
20 - * 格价格 20 + * 格价格
21 */ 21 */
22 - public function getGoodsSpecPriceAttr($value, $data) 22 + public function getGoodsStylePriceAttr($value, $data)
23 { 23 {
24 - $goods_spec = !empty($data['goods_spec']) ? json_decode($data['goods_spec'],true) : [];  
25 - return array_sum(SpecValue::where('id','in',$goods_spec)->column('spec_value_price')); 24 + $goods_style = !empty($data['goods_style']) ? json_decode($data['goods_style'],true) : [];
  25 + return array_sum(StyleValue::where('id','in',$goods_style)->column('style_value_price'));
26 } 26 }
27 } 27 }
@@ -60,7 +60,7 @@ class Order extends Model @@ -60,7 +60,7 @@ class Order extends Model
60 'goods_price' => $goods['goods_price'], 60 'goods_price' => $goods['goods_price'],
61 'goods_num' => $goods['goods_num'], 61 'goods_num' => $goods['goods_num'],
62 'user_size_id' => !empty($goods['user_size']) ? $goods['user_size']['id'] : 0, 62 'user_size_id' => !empty($goods['user_size']) ? $goods['user_size']['id'] : 0,
63 - 'goods_spec' => $goods['goods_spec'] 63 + 'goods_style' => $goods['goods_style']
64 ]; 64 ];
65 } 65 }
66 // 保存订单商品信息 66 // 保存订单商品信息
1 -<?php  
2 -  
3 -namespace app\common\model;  
4 -  
5 -use think\Model;  
6 -  
7 -class Spec extends Model  
8 -{  
9 - /**  
10 - * 正常显示规格  
11 - */  
12 - public static function specList($spec_template_id){  
13 - // 一级规格组  
14 - $list = self::getSpecList(['spec_template_id'=>$spec_template_id,'pid'=>0,'display_mode'=>'1']);  
15 - return $list;  
16 - }  
17 -  
18 - /**  
19 - * 规格值下规格  
20 - */  
21 - public static function valueSpecList($spec_value_id)  
22 - {  
23 - //规格值下规格组ID集合  
24 - $spec_ids = SpecValue::where('id',$spec_value_id)->value('spec_ids');  
25 - // 一级规格组  
26 - $list = self::where('id','in',$spec_ids)  
27 - ->field('id,pid,spec_name,spec_type')  
28 - ->order('weigh desc')  
29 - ->select();  
30 - foreach($list as &$v){  
31 - // 规格组选项  
32 - $v['options'] = self::getOptions($v['id']);  
33 - }  
34 - return $list;  
35 - }  
36 -  
37 - /**  
38 - * 身体信息  
39 - */  
40 - public static function bodyInfo($spec_template_id){  
41 - // 一级规格组  
42 - $list = self::getSpecList(['spec_template_id'=>$spec_template_id,'pid'=>0,'display_mode'=>'1']);  
43 - return $list;  
44 - }  
45 -  
46 - /**  
47 - * 获取规格列表  
48 - */  
49 - public static function getSpecList($where){  
50 - $list = self::where($where)  
51 - ->order('weigh desc')  
52 - ->select();  
53 - foreach($list as $v){  
54 - $v['spec_value_list'] = self::getSpecValueList($v['id']);  
55 - $v['two_spec_list'] = self::getSpecList(['pid'=>$v['id']]);  
56 - $v->visible(['id','spec_name','spec_type','display_mode'])->append(['spec_value_list','two_spec_list']);  
57 - }  
58 - $list = collection($list)->toArray();  
59 - return $list;  
60 - }  
61 -  
62 - /**  
63 - * 获取规格值列表  
64 - */  
65 - public static function getSpecValueList($spec_id){  
66 - $list = SpecValue::where('spec_id',$spec_id)  
67 - ->order('weigh desc')  
68 - ->select();  
69 - foreach($list as $v){  
70 - $v['spec_list'] = self::getSpecList(['id'=>['in',$v['spec_ids']]]);  
71 - $v->visible(['id','spec_id','spec_value','spec_value_image','spec_value_description','spec_ids'])->append(['spec_list']);  
72 - }  
73 - $list = collection($list)->toArray();  
74 - return $list;  
75 - }  
76 -}  
  1 +<?php
  2 +
  3 +namespace app\common\model;
  4 +
  5 +use think\Model;
  6 +
  7 +class Style extends Model
  8 +{
  9 + /**
  10 + * 获取风格列表
  11 + */
  12 + public static function styleList($style_template_id){
  13 + // 一级风格
  14 + $list = self::getStyleList(['style_template_id'=>$style_template_id,'pid'=>0,'display_mode'=>'1']);
  15 + return $list;
  16 + }
  17 +
  18 + /**
  19 + * 获取风格列表
  20 + */
  21 + public static function getStyleList($where){
  22 + $list = self::where($where)
  23 + ->order('weigh desc')
  24 + ->select();
  25 + foreach($list as $v){
  26 + $v['style_value_list'] = self::getStyleValueList($v['id']);
  27 + $v['two_style_list'] = self::getStyleList(['pid'=>$v['id']]);
  28 + $v->visible(['id','style_name','style_type','display_mode'])->append(['style_value_list','two_style_list']);
  29 + }
  30 + $list = collection($list)->toArray();
  31 + return $list;
  32 + }
  33 +
  34 + /**
  35 + * 获取选项列表
  36 + */
  37 + public static function getStyleValueList($style_id){
  38 + $list = StyleValue::where('style_id',$style_id)
  39 + ->order('weigh desc')
  40 + ->select();
  41 + foreach($list as $v){
  42 + $v['style_list'] = self::getStyleList(['id'=>['in',$v['style_ids']]]);
  43 + $v->visible(['id','style_id','style_value_name','style_value_image','style_value_desc','style_ids'])->append(['style_list']);
  44 + }
  45 + $list = collection($list)->toArray();
  46 + return $list;
  47 + }
  48 +}
@@ -4,7 +4,7 @@ namespace app\common\model; @@ -4,7 +4,7 @@ namespace app\common\model;
4 4
5 use think\Model; 5 use think\Model;
6 6
7 -class SpecValue extends Model 7 +class StyleValue extends Model
8 { 8 {
9 /** 9 /**
10 * 隐藏字段 10 * 隐藏字段
@@ -15,7 +15,7 @@ class SpecValue extends Model @@ -15,7 +15,7 @@ class SpecValue extends Model
15 'updatetime' 15 'updatetime'
16 ]; 16 ];
17 17
18 - public function getSpecValueImageAttr($value, $data) 18 + public function getStyleValueImageAttr($value, $data)
19 { 19 {
20 return !empty($value) ? cdnurl($value,true) : ''; 20 return !empty($value) ? cdnurl($value,true) : '';
21 } 21 }
此 diff 太大无法显示。
@@ -48,7 +48,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -48,7 +48,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
48 title: __('模特款'), 48 title: __('模特款'),
49 classname: 'btn btn-xs btn-warning btn-dialog', 49 classname: 'btn btn-xs btn-warning btn-dialog',
50 icon: 'fa fa-file', 50 icon: 'fa fa-file',
51 - url: 'goods/spec?goods_id={id}', 51 + url: 'goods/style?goods_id={id}',
52 visible: function(row){ 52 visible: function(row){
53 if(row.ismake == '1'){ 53 if(row.ismake == '1'){
54 return true; 54 return true;
@@ -71,35 +71,35 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -71,35 +71,35 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
71 edit: function () { 71 edit: function () {
72 Controller.api.bindevent(); 72 Controller.api.bindevent();
73 }, 73 },
74 - spec: function () { 74 + style: function () {
75 Controller.api.bindevent(); 75 Controller.api.bindevent();
76 setTimeout(function () { 76 setTimeout(function () {
77 - $("#c-spec_template_id").trigger("change"); 77 + $("#c-style_template_id").trigger("change");
78 }, 100); 78 }, 100);
79 }, 79 },
80 api: { 80 api: {
81 bindevent: function () { 81 bindevent: function () {
82 - var goods_spec = Config.goods_spec;  
83 - var hidden_spec_list = [];  
84 - $(document).on("change", "#c-spec_template_id", function () { 82 + var goods_style = Config.goods_style;
  83 + var hidden_style_list = [];
  84 + $(document).on("change", "#c-style_template_id", function () {
85 Fast.api.ajax({ 85 Fast.api.ajax({
86 - url:'goods/specList', 86 + url:'goods/styleList',
87 data:{ 87 data:{
88 - spec_template_id:$(this).val() 88 + style_template_id:$(this).val()
89 } 89 }
90 }, function(data, ret){ 90 }, function(data, ret){
91 if(ret.code == 1){ 91 if(ret.code == 1){
92 var list = ret.data.list; 92 var list = ret.data.list;
93 var html = '<div class="display_mode_1">'; 93 var html = '<div class="display_mode_1">';
94 - // 一级规格  
95 - html += spec_list(list); 94 + // 一级风格
  95 + html += style_list(list);
96 html += '<div>'; 96 html += '<div>';
97 $('.display_mode_1').remove(); 97 $('.display_mode_1').remove();
98 $('.layer-footer').before(html); 98 $('.layer-footer').before(html);
99 // 绑定上传事件 99 // 绑定上传事件
100 Form.events.plupload(); 100 Form.events.plupload();
101 Form.events.faselect(); 101 Form.events.faselect();
102 - // 显示隐藏 102 + // 显示隐藏
103 $("input:checked[type=radio]").trigger("change"); 103 $("input:checked[type=radio]").trigger("change");
104 } 104 }
105 return false; 105 return false;
@@ -110,14 +110,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -110,14 +110,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
110 }); 110 });
111 }); 111 });
112 112
113 - // 规格值下规格组 113 + // 选项下风格
114 $(document).on("change", "input[type=radio]", function () { 114 $(document).on("change", "input[type=radio]", function () {
115 - var spev_value_id = $(this).val();  
116 - var list = hidden_spec_list[spev_value_id]; 115 + var style_value_id = $(this).val();
  116 + var list = hidden_style_list[style_value_id];
117 $(this).parent().parent().parent().parent('.form-group').next('.display_mode_2').remove(); 117 $(this).parent().parent().parent().parent('.form-group').next('.display_mode_2').remove();
118 if(list.length > 0){ 118 if(list.length > 0){
119 var html = '<div class="display_mode_2">'; 119 var html = '<div class="display_mode_2">';
120 - html += spec_list(list); 120 + html += style_list(list);
121 html += '<div>'; 121 html += '<div>';
122 $(this).parent().parent().parent().parent('.form-group').after(html); 122 $(this).parent().parent().parent().parent('.form-group').after(html);
123 // 绑定上传事件 123 // 绑定上传事件
@@ -126,22 +126,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -126,22 +126,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
126 } 126 }
127 }); 127 });
128 128
129 - // 规格组  
130 - function spec_list(list){ 129 + // 风格
  130 + function style_list(list){
131 var html = ''; 131 var html = '';
132 - // 一级规格  
133 - $.each(list,function(index,spec){ 132 + // 一级风格
  133 + $.each(list,function(index,style){
134 html += '<div class="form-group">'+ 134 html += '<div class="form-group">'+
135 - '<label class="control-label col-xs-12 col-sm-2">'+spec.spec_name+':</label>'+ 135 + '<label class="control-label col-xs-12 col-sm-2">'+style.style_name+':</label>'+
136 '<div class="col-xs-12 col-sm-8">'+ 136 '<div class="col-xs-12 col-sm-8">'+
137 - spec_value_list(index,spec);  
138 - // 一级规格下二级规格  
139 - if(spec.two_spec_list.length > 0){  
140 - $.each(spec.two_spec_list,function(index,spec_s){ 137 + style_value_list(index,style);
  138 + // 一级风格下二级风格
  139 + if(style.two_style_list.length > 0){
  140 + $.each(style.two_style_list,function(index,style_s){
141 html += '<div class="form-group">'+ 141 html += '<div class="form-group">'+
142 - '<label class="control-label col-xs-12 col-sm-2">'+spec_s.spec_name+':</label>'+ 142 + '<label class="control-label col-xs-12 col-sm-2">'+style_s.style_name+':</label>'+
143 '<div class="col-xs-12 col-sm-8">'+ 143 '<div class="col-xs-12 col-sm-8">'+
144 - spec_value_list(index,spec_s)+ 144 + style_value_list(index,style_s)+
145 '</div>'+ 145 '</div>'+
146 '</div>'; 146 '</div>';
147 }) 147 })
@@ -152,41 +152,41 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -152,41 +152,41 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
152 return html; 152 return html;
153 } 153 }
154 154
155 - // 规格值  
156 - function spec_value_list(index,spec){ 155 + // 选项
  156 + function style_value_list(index,style){
157 var html = ''; 157 var html = '';
158 - // 规格下规格值  
159 - if(spec.spec_value_list.length > 0){ 158 + // 风格下选项
  159 + if(style.style_value_list.length > 0){
160 html += '<div class="radio">'; 160 html += '<div class="radio">';
161 - $.each(spec.spec_value_list,function(index,spec_v){  
162 - hidden_spec_list[spec_v.id] = spec_v.spec_list;  
163 - var img = spec_v.spec_value_image == '' ? '/assets/img/qrcode.png' : spec_v.spec_value_image;  
164 - var checked = goods_spec[spec_v.spec_id] == spec_v.id ? 'checked' : index == 0 ? 'checked' : '';  
165 - html += '<label for="'+spec_v.id+'" style="border:1px solid #f1f4f6">'+  
166 - '<input id="'+spec_v.id+'" '+checked+' name="row[goods_spec]['+spec_v.spec_id+']" type="radio" value="'+spec_v.id+'">'+ 161 + $.each(style.style_value_list,function(index,style_o){
  162 + hidden_style_list[style_o.id] = style_o.style_list;
  163 + var img = style_o.style_value_image == '' ? '/assets/img/qrcode.png' : style_o.style_value_image;
  164 + var checked = goods_style[style_o.style_id] == style_o.id ? 'checked' : index == 0 ? 'checked' : '';
  165 + html += '<label for="'+style_o.id+'" style="border:1px solid #f1f4f6">'+
  166 + '<input id="'+style_o.id+'" '+checked+' name="row[goods_style]['+style_o.style_id+']" type="radio" value="'+style_o.id+'">'+
167 '<img width="100px" src="'+img+'">'+ 167 '<img width="100px" src="'+img+'">'+
168 - '<p style="text-align:center">'+spec_v.spec_value+'</p>'+ 168 + '<p style="text-align:center">'+style_o.style_value_name+'</p>'+
169 '</label>'; 169 '</label>';
170 }) 170 })
171 html += '</div>'; 171 html += '</div>';
172 } 172 }
173 - // 规格下文本框  
174 - if(spec.spec_type == '2'){  
175 - var val = goods_spec[spec.id] == undefined ? '' : goods_spec[spec.id];  
176 - html += '<input id="c-'+spec.id+'" data-rule="required" class="form-control" name="row[goods_spec]['+spec.id+']" type="text" value="'+val+'">'; 173 + // 风格下文本框
  174 + if(style.style_type == '2'){
  175 + var val = goods_style[style.id] == undefined ? '' : goods_style[style.id];
  176 + html += '<input id="c-'+style.id+'" data-rule="required" class="form-control" name="row[goods_style]['+style.id+']" type="text" value="'+val+'">';
177 } 177 }
178 - // 规格下上传图片  
179 - if(spec.spec_type == '3'){  
180 - var val = goods_spec[spec.id] == undefined ? '' : goods_spec[spec.id]; 178 + // 风格下上传图片
  179 + if(style.style_type == '3'){
  180 + var val = goods_style[style.id] == undefined ? '' : goods_style[style.id];
181 html += '<div class="input-group">'+ 181 html += '<div class="input-group">'+
182 - '<input id="c-'+spec.id+'" data-rule="required" class="form-control" size="50" name="row[goods_spec]['+spec.id+']" type="text" value="'+val+'">'+ 182 + '<input id="c-'+style.id+'" data-rule="required" class="form-control" size="50" name="row[goods_style]['+style.id+']" type="text" value="'+val+'">'+
183 '<div class="input-group-addon no-border no-padding">'+ 183 '<div class="input-group-addon no-border no-padding">'+
184 - '<span><button type="button" id="plupload-'+spec.id+'" class="btn btn-danger plupload" data-input-id="c-'+spec.id+'" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-'+spec.id+'"><i class="fa fa-upload"></i> 上传</button></span>'+  
185 - '<span><button type="button" id="fachoose-'+spec.id+'" class="btn btn-primary fachoose" data-input-id="c-'+spec.id+'" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> 选择</button></span>'+ 184 + '<span><button type="button" id="plupload-'+style.id+'" class="btn btn-danger plupload" data-input-id="c-'+style.id+'" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-'+style.id+'"><i class="fa fa-upload"></i> 上传</button></span>'+
  185 + '<span><button type="button" id="fachoose-'+style.id+'" class="btn btn-primary fachoose" data-input-id="c-'+style.id+'" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> 选择</button></span>'+
186 '</div>'+ 186 '</div>'+
187 - '<span class="msg-box n-right" for="c-'+spec.id+'"></span>'+ 187 + '<span class="msg-box n-right" for="c-'+style.id+'"></span>'+
188 '</div>'+ 188 '</div>'+
189 - '<ul class="row list-inline plupload-preview" id="p-'+spec.id+'"></ul>'; 189 + '<ul class="row list-inline plupload-preview" id="p-'+style.id+'"></ul>';
190 } 190 }
191 return html; 191 return html;
192 } 192 }
@@ -5,13 +5,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -5,13 +5,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
5 // 初始化表格参数配置 5 // 初始化表格参数配置
6 Table.api.init({ 6 Table.api.init({
7 extend: { 7 extend: {
8 - index_url: 'spec/index' + location.search,  
9 - add_url: 'spec/add' + location.search,  
10 - edit_url: 'spec/edit',  
11 - del_url: 'spec/del',  
12 - multi_url: 'spec/multi',  
13 - import_url: 'spec/import',  
14 - table: 'spec', 8 + index_url: 'style/index' + location.search,
  9 + add_url: 'style/add' + location.search,
  10 + edit_url: 'style/edit',
  11 + del_url: 'style/del',
  12 + multi_url: 'style/multi',
  13 + import_url: 'style/import',
  14 + table: 'style',
15 } 15 }
16 }); 16 });
17 17
@@ -22,16 +22,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -22,16 +22,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
22 url: $.fn.bootstrapTable.defaults.extend.index_url, 22 url: $.fn.bootstrapTable.defaults.extend.index_url,
23 pk: 'id', 23 pk: 'id',
24 sortName: 'weigh', 24 sortName: 'weigh',
25 - escape: false,  
26 - pagination: false,  
27 - commonSearch: false,  
28 - search: false, 25 + escape: false,
  26 + pagination: false,
  27 + commonSearch: false,
  28 + search: false,
29 columns: [ 29 columns: [
30 [ 30 [
31 {checkbox: true}, 31 {checkbox: true},
32 {field: 'id', title: __('Id')}, 32 {field: 'id', title: __('Id')},
33 - {field: 'spec_name', title: __('Spec_name')},  
34 - {field: 'spec_type', title: __('Spec_type'), searchList: {"1":__('Spec_type 1'),"2":__('Spec_type 2'),"3":__('Spec_type 3')}, formatter: Table.api.formatter.normal}, 33 + {field: 'style_name', title: __('Style_name')},
  34 + {field: 'style_type', title: __('Style_type'), searchList: {"1":__('Style_type 1'),"2":__('Style_type 2'),"3":__('Style_type 3')}, formatter: Table.api.formatter.normal},
35 {field: 'display_mode', title: __('Display_mode'), searchList: {"1":__('Display_mode 1'),"2":__('Display_mode 2')}, formatter: Table.api.formatter.normal}, 35 {field: 'display_mode', title: __('Display_mode'), searchList: {"1":__('Display_mode 1'),"2":__('Display_mode 2')}, formatter: Table.api.formatter.normal},
36 {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 36 {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
37 {field: 'weigh', title: __('Weigh')}, 37 {field: 'weigh', title: __('Weigh')},
@@ -44,12 +44,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -44,12 +44,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
44 buttons: [ 44 buttons: [
45 { 45 {
46 name: 'detail', 46 name: 'detail',
47 - title: __('规格值'), 47 + title: __('风格选项'),
48 classname: 'btn btn-xs btn-warning btn-dialog', 48 classname: 'btn btn-xs btn-warning btn-dialog',
49 icon: 'fa fa-list', 49 icon: 'fa fa-list',
50 - url: 'spec_value?spec_id={id}', 50 + url: 'style_value?style_id={id}',
51 visible: function(row){ 51 visible: function(row){
52 - if(row.spec_type == '1'){ 52 + if(row.style_type == '1'){
53 return true; 53 return true;
54 } 54 }
55 } 55 }
@@ -63,46 +63,46 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -63,46 +63,46 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
63 63
64 // 为表格绑定事件 64 // 为表格绑定事件
65 Table.api.bindevent(table); 65 Table.api.bindevent(table);
66 -  
67 - //绑定TAB事件  
68 - $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {  
69 - // var options = table.bootstrapTable(tableOptions);  
70 - var typeStr = $(this).attr("href").replace('#t-', '');  
71 - var options = table.bootstrapTable('getOptions');  
72 - options.pageNumber = 1;  
73 - options.queryParams = function (params) {  
74 - // params.filter = JSON.stringify({type: typeStr});  
75 - params.display_mode = typeStr;  
76 -  
77 - return params;  
78 - };  
79 - table.bootstrapTable('refresh', {});  
80 - return false;  
81 -  
82 - }); 66 +
  67 + //绑定TAB事件
  68 + $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  69 + // var options = table.bootstrapTable(tableOptions);
  70 + var typeStr = $(this).attr("href").replace('#t-', '');
  71 + var options = table.bootstrapTable('getOptions');
  72 + options.pageNumber = 1;
  73 + options.queryParams = function (params) {
  74 + // params.filter = JSON.stringify({type: typeStr});
  75 + params.display_mode = typeStr;
  76 +
  77 + return params;
  78 + };
  79 + table.bootstrapTable('refresh', {});
  80 + return false;
  81 +
  82 + });
83 }, 83 },
84 add: function () { 84 add: function () {
85 Controller.api.bindevent(); 85 Controller.api.bindevent();
86 }, 86 },
87 edit: function () { 87 edit: function () {
88 Controller.api.bindevent(); 88 Controller.api.bindevent();
89 - setTimeout(function () {  
90 - if($("#c-pid").val() == 0){  
91 - $("#c-display_mode").trigger("change");  
92 - }  
93 - }, 100); 89 + setTimeout(function () {
  90 + if($("#c-pid").val() == 0){
  91 + $("#c-display_mode").trigger("change");
  92 + }
  93 + }, 100);
94 }, 94 },
95 api: { 95 api: {
96 bindevent: function () { 96 bindevent: function () {
97 - $(document).on("change", "#c-display_mode", function () {  
98 - $("#c-pid option[data-display_mode='all']").prop("selected", true);  
99 - if($(this).val() == 1){  
100 - $("#c-pid option[data-display_mode!='all']").removeClass("hide");  
101 - }else{  
102 - $("#c-pid option[data-display_mode!='all']").addClass("hide");  
103 - }  
104 - $("#c-pid").data("selectpicker") && $("#c-pid").selectpicker("refresh");  
105 - }); 97 + $(document).on("change", "#c-display_mode", function () {
  98 + $("#c-pid option[data-display_mode='all']").prop("selected", true);
  99 + if($(this).val() == 1){
  100 + $("#c-pid option[data-display_mode!='all']").removeClass("hide");
  101 + }else{
  102 + $("#c-pid option[data-display_mode!='all']").addClass("hide");
  103 + }
  104 + $("#c-pid").data("selectpicker") && $("#c-pid").selectpicker("refresh");
  105 + });
106 Form.api.bindevent($("form[role=form]")); 106 Form.api.bindevent($("form[role=form]"));
107 } 107 }
108 } 108 }
@@ -5,13 +5,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -5,13 +5,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
5 // 初始化表格参数配置 5 // 初始化表格参数配置
6 Table.api.init({ 6 Table.api.init({
7 extend: { 7 extend: {
8 - index_url: 'spec_template/index' + location.search,  
9 - add_url: 'spec_template/add',  
10 - edit_url: 'spec_template/edit',  
11 - del_url: 'spec_template/del',  
12 - multi_url: 'spec_template/multi',  
13 - import_url: 'spec_template/import',  
14 - table: 'spec_template', 8 + index_url: 'style_template/index' + location.search,
  9 + add_url: 'style_template/add',
  10 + edit_url: 'style_template/edit',
  11 + del_url: 'style_template/del',
  12 + multi_url: 'style_template/multi',
  13 + import_url: 'style_template/import',
  14 + table: 'style_template',
15 } 15 }
16 }); 16 });
17 17
@@ -41,18 +41,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -41,18 +41,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
41 title: __('规格列表'), 41 title: __('规格列表'),
42 classname: 'btn btn-xs btn-warning btn-addtabs', 42 classname: 'btn btn-xs btn-warning btn-addtabs',
43 icon: 'fa fa-list', 43 icon: 'fa fa-list',
44 - url: 'spec/index?spec_template_id={id}' 44 + url: 'style/index?style_template_id={id}'
45 } 45 }
46 ], 46 ],
47 formatter: function (value, row, index) { 47 formatter: function (value, row, index) {
48 - var that = $.extend({}, this);  
49 - var table = $(that.table).clone(true);  
50 - if(row.id == 1 || row.id == 2){  
51 - $(table).data("operate-del", null); // 列表页面隐藏 .编辑operate-edit - 删除按钮operate-del  
52 - }  
53 - that.table = table;  
54 - return Table.api.formatter.operate.call(that, value, row, index);  
55 - } 48 + var that = $.extend({}, this);
  49 + var table = $(that.table).clone(true);
  50 + if(row.id == 1 || row.id == 2){
  51 + $(table).data("operate-del", null); // 列表页面隐藏 .编辑operate-edit - 删除按钮operate-del
  52 + }
  53 + that.table = table;
  54 + return Table.api.formatter.operate.call(that, value, row, index);
  55 + }
56 }, 56 },
57 ] 57 ]
58 ] 58 ]
@@ -5,13 +5,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -5,13 +5,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
5 // 初始化表格参数配置 5 // 初始化表格参数配置
6 Table.api.init({ 6 Table.api.init({
7 extend: { 7 extend: {
8 - index_url: 'spec_value/index' + location.search,  
9 - add_url: 'spec_value/add' + location.search,  
10 - edit_url: 'spec_value/edit',  
11 - del_url: 'spec_value/del',  
12 - multi_url: 'spec_value/multi',  
13 - import_url: 'spec_value/import',  
14 - table: 'spec_value', 8 + index_url: 'style_value/index' + location.search,
  9 + add_url: 'style_value/add' + location.search,
  10 + edit_url: 'style_value/edit',
  11 + del_url: 'style_value/del',
  12 + multi_url: 'style_value/multi',
  13 + import_url: 'style_value/import',
  14 + table: 'style_value',
15 } 15 }
16 }); 16 });
17 17
@@ -22,16 +22,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -22,16 +22,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
22 url: $.fn.bootstrapTable.defaults.extend.index_url, 22 url: $.fn.bootstrapTable.defaults.extend.index_url,
23 pk: 'id', 23 pk: 'id',
24 sortName: 'weigh', 24 sortName: 'weigh',
25 - pagination: false,  
26 - commonSearch: false,  
27 - search: false, 25 + pagination: false,
  26 + commonSearch: false,
  27 + search: false,
28 columns: [ 28 columns: [
29 [ 29 [
30 {checkbox: true}, 30 {checkbox: true},
31 {field: 'id', title: __('Id')}, 31 {field: 'id', title: __('Id')},
32 - {field: 'spec_value', title: __('Spec_value')},  
33 - {field: 'spec_value_image', title: __('Spec_value_image'), events: Table.api.events.image, formatter: Table.api.formatter.image},  
34 - {field: 'spec_value_price', title: __('Spec_value_price'), operate:'BETWEEN'}, 32 + {field: 'style_value_name', title: __('Style_value_name')},
  33 + {field: 'style_value_image', title: __('Style_value_image'), events: Table.api.events.image, formatter: Table.api.formatter.image},
  34 + {field: 'style_value_price', title: __('Style_value_price'), operate:'BETWEEN'},
35 {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 35 {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
36 {field: 'weigh', title: __('Weigh')}, 36 {field: 'weigh', title: __('Weigh')},
37 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 37 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}