| 12345678910111213141516171819202122232425262728 |
- // 商品详情已选规格
- var specSelected = function(value) {
- if (!value) return ''
- return value.map(function(val) {
- return val = val.filter(function(v) {
- return v.is_active
- }).filter(function(v) {
- return v
- }).map(function(v) {
- return v.name
- }).join()
- }).join(',')
- }
- // 购物车显示规格
- var getCartSpec = function(specs) {
- if (!specs) return ''
- return specs.map(function(spec) {
- return spec.split(',').map(function(s) {
- return s.split(':')[1]
- })
- }).join(',')
- }
- module.exports = {
- getCartSpec: getCartSpec,
- specSelected: specSelected,
- }
|