商家商品选择器增强功能开发说明

一、名称

$.GoodsSellerSelector

二、操作体验:

1.未选择商品初始化效果:

代码:

$(".somedom").GoodsSellerSelector({
   maxLength: 0, //可选择商品数量0表示不限制,默认是不限制 
   refresh: function (goods) { //每次商品变化后的回调函数
  }
});
  1. 点击“选择商品”直接弹出商品选择器的对话框,进行商品选择:

  1. 选择后

  1. 已有商品初始化效果

代码:

$(".somedom").GoodsSellerSelector({
   goodsidList:[1,2,3],
   maxLength: 0, //可选择商品数量0表示不限制,默认是不限制
   refresh: function (goods) { //每次商品变化后的回调函数
  }
});

效果:

此时需要调用到商品获取api:

/shop/goods/1,2,3

返回数据格式:

[{
    "goods_id": 156,
    "name": "centrum/善存复合维生素 男士多维片矿物质",
    "sn": "00050",
    "thumbnail": "http://static.b2b2cv2.javamall.com.cn/attachment//store/1/goods/2017/6/14/14//56121918_thumbnail.jpg",
    "enable_store": 0,
    "store": 0,
    "price": 99,
    "create_time": 1497423336,
    "market_enable": 1,
    "brand_name": "维生素/矿物质",
    "category_name": "维生素/矿物质"
}
,
{another one}
]

注意:每次选中商品变化时(新增选中或被取消选中时)要回掉refresh方法

results matching ""

    No results matching ""