orderRatingPopup.js
2.5 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
// import api from '../../api/api.js'
// import Util from '../../utils/util'
Component({
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
/*组件的属性列表*/
properties: {
title: {
type: String,
value: '标题'
},
// 弹窗内容
content: {
type: String,
value: '内容'
},
// 弹窗取消按钮文字
btn_no: {
type: String,
value: '取消'
},
// 弹窗确认按钮文字
btn_ok: {
type: String,
value: '补录这笔订单'
},
//是否显示取消按钮
isShowCancel: {
type: Boolean,
value: true
},
//是否显示右上角关闭按钮
isShowClose: {
type: Boolean,
value: true
},
//应用于某些场景的button的open-type属性
sureButtonType: {
type: String,
value: ''
},
//控制弹窗的显示
flag: {
type: Boolean,
value: true
},
orderInfoSetting: {
type: Object,
value: {},
observer: function (n) {
console.log(n, 'orderInfoSetting')
n && this.setOrderInfo(n)
}
}
},
/* 组件的初始数据 */
data: {
wrapAnimate: 'wrapAnimate',
popupAnimate: 'popupAnimate',
tags: [
{
name: '服务态度好',
value: '1',
checked: false
},
{
name: '性价比高',
value: '2',
checked: false
},
{
name: '价格便宜',
value: '3',
checked: false
},
{
name: '一般',
value: '4',
checked: false
}
],
orderInfo: {}
},
lifetimes: {
attached: function () {
// 在组件实例进入页面节点树时执行
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
}
},
/* 组件的方法列表 */
methods: {
setOrderInfo(orderInfo) {
console.log(orderInfo, 'orderInfo')
orderInfo.evaluation = orderInfo.evaluation.split(',')
console.log(orderInfo.evaluation, 'orderInfo.evaluation')
let { tags } = this.data
tags.forEach((item, index) => {
if (orderInfo.evaluation.includes(item.value)) {
item.checked = true
}
})
this.setData({
orderInfo,
tags
})
},
/* 内部私有方法建议以下划线开头 triggerEvent 用于触发事件 */
_close() {
//触发取消回调
this.triggerEvent('close')
},
_success() {}
}
})