gbshop.js
5.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
* Created by kkb on 15/8/25.
*/
$(function(){
//自定义产品js
var gbdatas = [
{
item_pic:global_contextPath + '/networks/themes/img/gifts/tshirt_male_black.jpg',
item_title:'极客标签T侐',
item_price_cash: '60',
item_price_coin: '600',
item_pics: 'tshirt_male_black.jpg',
item_description: '舒适又炫酷的极客T恤,穿着它去寻找你的极客小伙伴吧~',
item_code: '001'
},
{
item_pic:global_contextPath + '/networks/themes/img/gifts/mpad.jpg',
item_title:'极客标签鼠标垫',
item_price_cash: '10',
item_price_coin: '100',
item_pics: 'mpad.jpg',
item_description: '非常有极客范儿的鼠标垫,开发人员必备~',
item_code: '002'
},
{
item_pic:global_contextPath + '/networks/themes/img/gifts/cup.jpg',
item_title:'极客标签马克杯',
item_price_cash: '30',
item_price_coin: '300',
item_pics: 'cup.jpg',
item_description: '工作的同时,也要注意健康问题,尽量多饮水~',
item_code: '003'
},
{
item_pic:global_contextPath + '/networks/themes/img/gifts/udisk.jpg',
item_title:'极客标签U盘',
item_price_cash: '40',
item_price_coin: '400',
item_pics: 'udisk.jpg',
item_description: '颜值高、样式又炫酷的8GB卡片U盘,是你办公的好助手~',
item_code: '004'
},
{
item_pic:global_contextPath + '/networks/themes/img/gifts/bag.jpg',
item_title:'极客标签帆布包',
item_price_cash: '20',
item_price_coin: '200',
item_pics: 'udisk.jpg',
item_description: '简洁、大方 又环保的极客帆布包,可重复利用~',
item_code: '005'
}];
// 初始化shop页面
(function(){
var $gb_items_container = $('#gb-items-container'),
$gb_items_tpl = $('#gb-items-tpl'),
template,
html;
if($gb_items_tpl.length > 0 && gbdatas && gbdatas.length > 0){
template = Handlebars.compile($gb_items_tpl.html());
html = template(gbdatas);
$gb_items_container.html(html);
}
})();
//通知店小二购买
$('.container').on('click','.item-call-waiter',sendMsg);
function sendMsg(){
var $this = $(this);
$.msg({
buttons:[
{
'确定': function(){
if(global_onlineuser.uid > 0){
var msg = '我要来一件 ',
mtdo = {},
$parentItem = $this.parents('.gb-item');
$parentItem = $parentItem.length <= 0 ? $this.parents('.cd-item-info') : $parentItem;
msg += '编号为: '+$parentItem.data('code') + '-'+$parentItem.data('title') + ' 的物品';
mtdo.fuid = global_onlineuser.uid;
mtdo.tuid = $('#gb-items-container').data('manager');
mtdo.message = msg;
mtdo.creationdate = new Date();
mtdo.deleted = 0;
identityService.addMessage(mtdo,function(){
$.msg({
buttons:[
{
'知道了': function(){
if(!$('#quick-view-container').is(':hidden')){
closeQuickView( sliderFinalWidth, maxQuickWidth);
}
}
}
],
msg: '已经通知店小二了,她会及时联系你的'
});
});
}else{
$.msg({
buttons:[
{
'知道了': function(){
if(!$('#quick-view-container').is(':hidden')){
closeQuickView( sliderFinalWidth, maxQuickWidth);
}
}
}
],
msg: '登录后才可以购买!'
});
}
}
},
{
'取消': function(){
if(!$('#quick-view-container').is(':hidden')){
closeQuickView( sliderFinalWidth, maxQuickWidth);
}
}
}
],
msg:'确定要通知店小二么?'
});
}
});