商家调用 :

适当时刻调用选择器方法

<div id='test'></div>
<!--PS: 禁止在此div标签内写任何代码,因为调用插件后,会覆盖掉标签内的东西-->
$("#test").GoodsSellerSelector({
    maxLength: 0,  //最大可选商品数量,0代表无数量限制.
    goodsIdList: [152, 153], // 默认选择的商品ID
    refresh: function (data) {   // 商品数据发生变化时的回调函数.
        console.log('Goods has changed-->',data);
    }
});

不带面板

$.GoodsSellerSelector({
    maxLength: 0, //最大可选商品数量,0代表无数量限制.
    defaultData: [152, 153], // 默认选择的商品ID
    confirm: function (data) { // 商品数据发生变化时的回调函数.
        console.log('Goods has changed-->', data);
    }
});

返回数据格式示例:

{
    "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": "维生素/矿物质"
}

PS : JS文件在header.html中被引用

管理员调用:

(不带面板)

$.GoodsAdminSelector({
    maxLength: 0, //最大可选商品数量,0代表无数量限制.
    defaultData: [152, 153], // 默认选择的商品ID
    confirm: function (data) { // 商品数据发生变化时的回调函数.
        console.log('Goods has changed-->', data);
    }
});

results matching ""

    No results matching ""