order-goods-row.js
3.02 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
132
133
134
135
136
137
138
139
140
141
Component({
options: {
addGlobalClass: true
},
properties: {
product: {
type: Object,
value: {}
},
djOrderType: {
type: Number,
value: 1
},
selectPayType: {
type: Number,
value: 0
},
lowPriceFlag: {
type: Number,
value: 0
},
index: {
type: Number,
value: 0
},
gindex: {
type: Number,
value: -1
},
count: {
type: Number,
value: 1
},
isPackageSubItem: {
type: Boolean,
value: false
},
positionTypeList: {
type: Array,
value: []
},
baseConfigData: {
type: Object,
value: {}
},
positionNum: {
type: String,
value: ''
},
popupType: {
type: String,
value: '2'
},
showPopupName: {
type: String,
value: 'goodsBox'
},
productName: {
type: String,
value: ''
},
/** selectOrderGoods.list 返回,1 展示活动标 */
marketingFlag: {
type: Number,
value: 0
},
/** 行级 activityId,与 marketingFlag 共同判定活动商品不可改价 */
activityId: {
type: null,
value: null
}
},
methods: {
changePrice(e) {
const { marketingFlag, activityId, product } = this.data
const locked =
product?.goodsPriceModify ||
((marketingFlag == 1 || product?.marketingFlag == 1) &&
(activityId || product?.activityId))
if (locked) return
this.triggerEvent('priceChange', {
value: e.detail.value,
index: this.data.index,
gindex: this.data.gindex,
item: this.data.product
})
},
priceBlur(e) {
this.triggerEvent('priceBlur', {
index: this.data.index,
gindex: this.data.gindex
})
},
changeProductDiscountType(e) {
const { type } = e.currentTarget.dataset
this.triggerEvent('discountTypeChange', {
type,
index: this.data.index,
gindex: this.data.gindex
})
},
inputDiscountValue(e) {
this.triggerEvent('discountValueInput', {
value: e.detail.value,
index: this.data.index,
gindex: this.data.gindex
})
},
toggleGift(e) {
this.triggerEvent('toggleGift', {
value: e.detail.value,
index: this.data.index,
gindex: this.data.gindex
})
},
delGoodsList() {
this.triggerEvent('delete', {
index: this.data.index
})
},
showPopup(e) {
const dataset = e.currentTarget.dataset
// Pass the dataset needed for popup
this.triggerEvent('showPopup', {
...dataset,
index: this.data.index,
gindex: this.data.gindex
})
},
// For package sub-items, sometimes we need to know if it's the package itself or item inside
changeMealPrice(e) {
this.triggerEvent('mealPriceChange', {
value: e.detail.value,
index: this.data.index,
gindex: this.data.gindex,
item: this.data.product
})
}
}
})