商品规格新增扩展数据

feat/task1-c-wallet
gongfuxiang 2019-07-22 00:46:16 +08:00
parent cb5faccc59
commit 2ea5f9008b
4 changed files with 17 additions and 31 deletions

View File

@ -248,7 +248,7 @@
<input type="text" name="specifications_original_price[]" placeholder="原价" class="am-radius" pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" data-validation-message="请填写有效的原价" value="{{if $v['data']['original_price'] gt 0}}{{$v.data.original_price}}{{/if}}" />
</td>
<td>
<input type="hidden" name="specifications_extends[]" value="" class="line-extend-input" />
<input type="hidden" name="specifications_extends[]" value="{{$v.data.extends}}" class="line-extend-input" />
<span class="fs-12 cr-blue c-p line-extend-btn">编辑</span>
</td>
<td>
@ -532,13 +532,4 @@ function SpecificationsExtendsBack()
$('.specifications-table').find($extends_popup.attr('data-line-extend')).find('.line-extend-input').val(JSON.stringify(data));
$extends_popup.modal('close');
}
$(function()
{
{{if !empty($data['attribute'])}}
{{foreach $data.attribute as $v}}
$('ul.attribute-items-ul-{{$v.id}}').dragsort({ dragSelector: 'i.drag-sort-submit', placeHolderTemplate: '<li class="drag-sort-dotted"></li>'});
{{/foreach}}
{{/if}}
});
</script>

View File

@ -1213,7 +1213,7 @@ class GoodsService
$images = [];
// 基础字段数据字段长度
$base_count = 6;
$base_count = 7;
// 规格值
foreach($params as $k=>$v)
@ -1227,7 +1227,12 @@ class GoodsService
{
foreach($v as $ks=>$vs)
{
$data[$ks][] = $vs;
if($keys[1] == 'extends')
{
$data[$ks][] = empty($vs) ? null : htmlspecialchars_decode($vs);
} else {
$data[$ks][] = $vs;
}
}
}
}
@ -1539,7 +1544,7 @@ class GoodsService
{
// 基础字段
$count = count($data['data'][0]);
$temp_key = ['price', 'inventory', 'weight', 'coding', 'barcode', 'original_price'];
$temp_key = ['price', 'inventory', 'weight', 'coding', 'barcode', 'original_price', 'extends'];
$key_count = count($temp_key);
// 等于key总数则只有一列基础规格

View File

@ -1,20 +1,18 @@
/*
Navicat Premium Data Transfer
Navicat MySQL Data Transfer
Source Server :
Source Server Type : MySQL
Source Server Version : 50722
Source Server Version : 50716
Source Host : localhost
Source Database : shopxo_test
Source Database : shopxo_ttt
Target Server Type : MySQL
Target Server Version : 50722
Target Server Version : 50716
File Encoding : utf-8
Date: 07/19/2019 09:28:34 AM
Date: 07/22/2019 00:35:02 AM
*/
SET NAMES utf8mb4;
SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
@ -619,6 +617,7 @@ CREATE TABLE `s_goods_spec_base` (
`coding` char(80) NOT NULL DEFAULT '' COMMENT '编码',
`barcode` char(80) NOT NULL DEFAULT '' COMMENT '条形码',
`original_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '原价',
`extends` longtext COMMENT '扩展数据(json格式存储)',
`add_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '添加时间',
PRIMARY KEY (`id`),
KEY `attribute_type_id` (`price`)
@ -628,7 +627,7 @@ CREATE TABLE `s_goods_spec_base` (
-- Records of `s_goods_spec_base`
-- ----------------------------
BEGIN;
INSERT INTO `s_goods_spec_base` VALUES ('21', '3', '3888.00', '232', '0.00', '', '', '6866.00', '1547452007'), ('22', '4', '1999.00', '528', '0.00', '', '', '2300.00', '1547452553'), ('23', '5', '2499.00', '426', '0.00', '', '', '3200.00', '1547452798'), ('25', '6', '2998.90', '316', '0.00', '', '', '3200.00', '1547453157'), ('154', '8', '356.00', '33', '0.00', '', '', '672.00', '1554485486'), ('155', '7', '168.00', '313', '0.00', '', '', '760.00', '1554485498'), ('163', '9', '120.00', '12', '0.30', '', '', '160.00', '1554555420'), ('164', '9', '120.00', '86', '0.30', '', '', '160.00', '1554555420'), ('165', '9', '120.00', '13', '0.30', '', '', '160.00', '1554555420'), ('166', '9', '120.00', '76', '0.30', '', '', '160.00', '1554555420'), ('167', '9', '136.00', '43', '0.30', '', '', '188.00', '1554555420'), ('168', '9', '136.00', '53', '0.30', '', '', '188.00', '1554555420'), ('169', '9', '136.00', '21', '0.30', '', '', '188.00', '1554555420'), ('170', '9', '158.00', '243', '0.30', '', '', '216.00', '1554555420'), ('171', '9', '158.00', '45', '0.30', '', '', '216.00', '1554555420'), ('172', '2', '6050.00', '99', '0.00', '', '', '6800.00', '1554555460'), ('173', '2', '6600.00', '198', '0.00', '', '', '7200.00', '1554555460'), ('174', '2', '6800.00', '299', '0.00', '', '', '7600.00', '1554555460'), ('175', '2', '6050.00', '300', '0.00', '', '', '6800.00', '1554555460'), ('176', '2', '6600.00', '299', '0.00', '', '', '7200.00', '1554555460'), ('177', '2', '6800.00', '300', '0.00', '', '', '7600.00', '1554555460'), ('178', '2', '4500.00', '93', '0.00', '', '', '6800.00', '1554555460'), ('179', '2', '4800.00', '49', '0.00', '', '', '6600.00', '1554555460'), ('180', '2', '5500.00', '52', '0.00', '', '', '6000.00', '1554555460'), ('181', '1', '2100.00', '119', '0.00', '', '', '3200.00', '1554556830'), ('220', '10', '228.00', '28', '0.00', '', '', '568.00', '1557027030'), ('224', '11', '258.00', '36665655', '0.00', '', '', '268.00', '1558596805'), ('225', '11', '238.00', '322', '0.00', '', '', '0.00', '1558596805'), ('226', '11', '160.00', '0', '0.00', '', '', '0.00', '1558596805'), ('257', '12', '0.01', '4', '0.50', 'gg11', 'txm11', '188.00', '1561652576'), ('258', '12', '128.00', '61', '0.10', 'gg22', 'txm22', '188.00', '1561652576'), ('259', '12', '128.00', '41', '1.90', 'gg33', 'txm33', '188.00', '1561652576'), ('260', '12', '118.00', '0', '457.60', 'gg44', 'txm44', '150.00', '1561652576'), ('261', '12', '118.00', '0', '37.00', 'gg55', 'txm55', '150.00', '1561652576');
INSERT INTO `s_goods_spec_base` VALUES ('21', '3', '3888.00', '232', '0.00', '', '', '6866.00', null, '1547452007'), ('22', '4', '1999.00', '528', '0.00', '', '', '2300.00', null, '1547452553'), ('23', '5', '2499.00', '426', '0.00', '', '', '3200.00', null, '1547452798'), ('25', '6', '2998.90', '316', '0.00', '', '', '3200.00', null, '1547453157'), ('154', '8', '356.00', '33', '0.00', '', '', '672.00', null, '1554485486'), ('155', '7', '168.00', '313', '0.00', '', '', '760.00', null, '1554485498'), ('163', '9', '120.00', '12', '0.30', '', '', '160.00', null, '1554555420'), ('164', '9', '120.00', '86', '0.30', '', '', '160.00', null, '1554555420'), ('165', '9', '120.00', '13', '0.30', '', '', '160.00', null, '1554555420'), ('166', '9', '120.00', '76', '0.30', '', '', '160.00', null, '1554555420'), ('167', '9', '136.00', '43', '0.30', '', '', '188.00', null, '1554555420'), ('168', '9', '136.00', '53', '0.30', '', '', '188.00', null, '1554555420'), ('169', '9', '136.00', '21', '0.30', '', '', '188.00', null, '1554555420'), ('170', '9', '158.00', '243', '0.30', '', '', '216.00', null, '1554555420'), ('171', '9', '158.00', '45', '0.30', '', '', '216.00', null, '1554555420'), ('172', '2', '6050.00', '99', '0.00', '', '', '6800.00', null, '1554555460'), ('173', '2', '6600.00', '198', '0.00', '', '', '7200.00', null, '1554555460'), ('174', '2', '6800.00', '299', '0.00', '', '', '7600.00', null, '1554555460'), ('175', '2', '6050.00', '300', '0.00', '', '', '6800.00', null, '1554555460'), ('176', '2', '6600.00', '299', '0.00', '', '', '7200.00', null, '1554555460'), ('177', '2', '6800.00', '300', '0.00', '', '', '7600.00', null, '1554555460'), ('178', '2', '4500.00', '93', '0.00', '', '', '6800.00', null, '1554555460'), ('179', '2', '4800.00', '49', '0.00', '', '', '6600.00', null, '1554555460'), ('180', '2', '5500.00', '52', '0.00', '', '', '6000.00', null, '1554555460'), ('181', '1', '2100.00', '119', '0.00', '', '', '3200.00', null, '1554556830'), ('220', '10', '228.00', '28', '0.00', '', '', '568.00', null, '1557027030'), ('224', '11', '258.00', '36665655', '0.00', '', '', '268.00', null, '1558596805'), ('225', '11', '238.00', '322', '0.00', '', '', '0.00', null, '1558596805'), ('226', '11', '160.00', '0', '0.00', '', '', '0.00', null, '1558596805'), ('257', '12', '0.01', '4', '0.50', 'gg11', 'txm11', '188.00', null, '1561652576'), ('258', '12', '128.00', '61', '0.10', 'gg22', 'txm22', '188.00', null, '1561652576'), ('259', '12', '128.00', '41', '1.90', 'gg33', 'txm33', '188.00', null, '1561652576'), ('260', '12', '118.00', '0', '457.60', 'gg44', 'txm44', '150.00', null, '1561652576'), ('261', '12', '118.00', '0', '37.00', 'gg55', 'txm55', '150.00', null, '1561652576');
COMMIT;
-- ----------------------------

View File

@ -182,7 +182,6 @@ $(function()
// 拖拽
$('ul.goods-photo-view').dragsort({ dragSelector: 'img', placeHolderTemplate: '<li class="drag-sort-dotted"></li>'});
$('ul.content-app-items').dragsort({ dragSelector: 'i.drag-sort-submit', placeHolderTemplate: '<li class="drag-sort-dotted"></li>'});
$('ul.goods-attribute-items').dragsort({ dragSelector: 'i.drag-sort-submit', placeHolderTemplate: '<li class="drag-sort-dotted"></li>'});
// 规格扩展数据编辑
@ -198,12 +197,4 @@ $(function()
}
$extends_popup.modal();
});
// 规格扩展数据
$('#specifications-extends-popup button[type="button"]').on('click', function()
{
// var data = GetFormVal('#specifications-extends-popup', true);
// $('.specifications-table').find($extends_popup.attr('data-line-extend')).find('.line-extend-input').val(JSON.stringify(data));
// $extends_popup.modal('close');
});
});