hh-doctor-sdk 0.2.9 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,6 +41,14 @@ const apiPaths = {
41
41
  hostType: hostDefine.hostTypes.order,
42
42
  path: '/orderplan/reply_order'
43
43
  },
44
+ doctorAsk: {
45
+ hostType: hostDefine.hostTypes.order,
46
+ path: '/orderask/ask_order_doctor'
47
+ }, // 医生追问回复
48
+ doctorSupply: {
49
+ hostType: hostDefine.hostTypes.order,
50
+ path: '/orderask/ask_order_doctor'
51
+ }, // 医生补充资料
44
52
  orderList: {
45
53
  hostType: hostDefine.hostTypes.order,
46
54
  path: '/orderlist/doctor_order_task_list'
@@ -149,6 +157,12 @@ function requestReply(type, params, body) {
149
157
  case menuBuilder.ChatEventType.reply:
150
158
  requestPath = apiPaths.expertReply
151
159
  break
160
+ case menuBuilder.ChatEventType.doctorAsk:
161
+ requestPath = apiPaths.doctorAsk
162
+ break
163
+ case menuBuilder.ChatEventType.dAddSupply:
164
+ requestPath = apiPaths.doctorSupply
165
+ break
152
166
  }
153
167
  return httpUtils.post(requestPath, params, body, null)
154
168
  }
@@ -67,6 +67,9 @@ Component({
67
67
  case menuBuilder.ChatEventType.reply:
68
68
  this._forwart2Reply(menuBuilder.ChatEventType.reply)
69
69
  break
70
+ case menuBuilder.ChatEventType.doctorAsk:
71
+ this._forwart2Reply(menuBuilder.ChatEventType.doctorAsk)
72
+ break
70
73
  }
71
74
  },
72
75
 
@@ -45,10 +45,3 @@
45
45
  .chat-menu-item.border {
46
46
  border-left: 1rpx #dcdcdcff solid;
47
47
  }
48
-
49
- .menu-border {
50
- width: 1rpx;
51
- background-color: #dcdcdcff;
52
- /* border-left: 1rpx #dcdcdcff solid; */
53
- margin: 8rpx 0;
54
- }
@@ -7,6 +7,9 @@ const OrderState = {
7
7
  rejected: 3,
8
8
  timeout: 4,
9
9
  addSupplement: 15,
10
+ giveUp: 9,
11
+ giveUpComplete: 10,
12
+ confirm: 12,
10
13
  }
11
14
 
12
15
  const ChatEventType = {
@@ -18,7 +21,11 @@ const ChatEventType = {
18
21
  startVideo: 'startVideo',
19
22
  videoMore: 'videoMore',
20
23
  visitConfirm: 'visitConfirm',
21
- visitReject: 'visitReject'
24
+ visitReject: 'visitReject',
25
+
26
+ cancel: 'cancel',
27
+ doctorAsk: 'doctorAsk',
28
+ dAddSupply: 'dAddSupply'
22
29
  }
23
30
 
24
31
  function orderMenus(order) {
@@ -27,7 +34,7 @@ function orderMenus(order) {
27
34
  }
28
35
  const isRequest = cache.isRequest(order.doctorid)
29
36
  if (isRequest) {
30
- return []
37
+ return _doctorNormalMenu(order)
31
38
  }
32
39
  const provideType = order.provideType
33
40
  if (!isRequest && provideType && provideType.length > 0 && provideType != 'normal') {
@@ -41,6 +48,9 @@ function orderMenus(order) {
41
48
  return _normalMenus(order)
42
49
  }
43
50
 
51
+ /**
52
+ * 专家视频订单菜单
53
+ * */
44
54
  function _videoMenus(order) {
45
55
  var menus = []
46
56
  const state = order.state
@@ -63,6 +73,9 @@ function _videoMenus(order) {
63
73
  return menus
64
74
  }
65
75
 
76
+ /**
77
+ * 专家飞刀订单菜单
78
+ * */
66
79
  function _feidaoMenus(order) {
67
80
  var menus = []
68
81
  const state = order.state
@@ -82,6 +95,9 @@ function _feidaoMenus(order) {
82
95
  return menus
83
96
  }
84
97
 
98
+ /**
99
+ * 专家普通订单菜单
100
+ * */
85
101
  function _normalMenus(order) {
86
102
  var menus = []
87
103
  const state = order.state
@@ -107,17 +123,62 @@ function _normalMenus(order) {
107
123
  if (haveInvite) {
108
124
  menus.push(_menu(ChatEventType.discuss, '内部讨论'))
109
125
  menus.push(_menu(ChatEventType.reply, '回复意见', 1))
110
- } else {
111
- menus.push(_menu(ChatEventType.reply, '回复意见', 1))
112
126
  }
113
127
  break
114
128
  default:
115
- menus.push(_menu(ChatEventType.reply, '回复意见', 1))
129
+ // menus.push(_menu(ChatEventType.reply, '回复意见', 1))
116
130
  break;
117
131
  }
118
132
  return menus
119
133
  }
120
134
 
135
+ /**
136
+ * 提单医生普通菜单
137
+ * @param {*} order 订单
138
+ */
139
+ function _doctorNormalMenu(order) {
140
+ var menus = []
141
+ const state = order.state
142
+ console.error(`order state => ${state}`)
143
+ const isPaySuccess = (order.needPayMoney || 0) <= 0
144
+ const canFeedback = order.orderMessage && (order.orderMessage.needDoctorFeedback || false)
145
+ const canAsk = (order.isask || 0) == 1
146
+ switch (state) {
147
+ case OrderState.timeout:
148
+ case OrderState.rejected:
149
+ menus.push(_menu(ChatEventType.cancel, '直接退款'))
150
+ break
151
+ case OrderState.giveUp:
152
+ case OrderState.giveUpComplete:
153
+ break
154
+ case OrderState.submit:
155
+ if (isPaySuccess) {
156
+ menus.push(_menu(ChatEventType.doctorAsk, '讨论交流'))
157
+ }
158
+ break
159
+ case OrderState.finished:
160
+ if (canAsk && !canFeedback) {
161
+ menus.push(_menu(ChatEventType.doctorAsk, '讨论交流'))
162
+ }
163
+ break
164
+ case OrderState.confirm:
165
+ if (canFeedback) {
166
+ menus.push(_menu(ChatEventType.doctorAsk, '讨论交流'))
167
+ }
168
+ break
169
+ case OrderState.accepted:
170
+ menus.push(_menu(ChatEventType.doctorAsk, '讨论交流'))
171
+ break
172
+ case OrderState.addSupplement:
173
+ menus.push(_menu(ChatEventType.dAddSupply, '补充资料'))
174
+ menus.push(_menu(ChatEventType.doctorAsk, '讨论交流'))
175
+ break
176
+ default:
177
+ break
178
+ }
179
+ return menus
180
+ }
181
+
121
182
  function _menu(type, text, style = 0) {
122
183
  return {
123
184
  type: type,
@@ -52,9 +52,9 @@ module.exports = Behavior({
52
52
  // console.error(JSON.stringify(orderModel))
53
53
  if (orderModel) {
54
54
  var orderGroups = []
55
- if (orderModel.requestOrderList && orderModel.requestOrderList.length > 0) {
56
- orderGroups.push(this._buildGroup(true, '我的咨询', orderModel.requestOrderList))
57
- }
55
+ // if (orderModel.requestOrderList && orderModel.requestOrderList.length > 0) {
56
+ // orderGroups.push(this._buildGroup(true, '我的咨询', orderModel.requestOrderList))
57
+ // }
58
58
  if (orderModel.responseOrderList && orderModel.responseOrderList.length > 0) {
59
59
  orderGroups.push(this._buildGroup(false, '我的回复', orderModel.responseOrderList))
60
60
  }
@@ -74,7 +74,7 @@ module.exports = Behavior({
74
74
  return {
75
75
  title: title,
76
76
  list: list,
77
- showSection: true,
77
+ showSection: false,
78
78
  }
79
79
  },
80
80
 
@@ -39,9 +39,11 @@ Page({
39
39
  if (judgeLogin) {
40
40
  wx.statLog.sendStatLog(null, '打开咨询单列表界面')
41
41
  const doctorId = wx.getStorageSync('doctorId') || ''
42
+ console.error(`doctorId => ${doctorId}`)
42
43
  const isTest = (getApp().globalData.profileName || 'prod') == 'test'
43
44
  cache.cache({
44
- isTest: isTest
45
+ isTest: isTest,
46
+ doctorId: doctorId
45
47
  })
46
48
  if (!doctorId) {
47
49
  wx.showModal({
@@ -1,6 +1,7 @@
1
1
  const menuBuilder = require('../../detail/widget/chat-bottom/chat-menu-builder')
2
2
  const api = require('../../../apis/order-app-api')
3
3
  const checkPermission = require('../../../utils/permission-utils')
4
+ const cache = require('../../../public/cache-data')
4
5
 
5
6
  module.exports = Behavior({
6
7
 
@@ -48,6 +49,7 @@ module.exports = Behavior({
48
49
  placeHolder = '请在此填写拒绝原因'
49
50
  break
50
51
  case menuBuilder.ChatEventType.reply:
52
+ case menuBuilder.ChatEventType.doctorAsk:
51
53
  title = '填写回复内容'
52
54
  placeHolder = '请在此填回复内容'
53
55
  break
@@ -88,9 +90,14 @@ module.exports = Behavior({
88
90
  nullTip = '请补充需要补充资料原因'
89
91
  break
90
92
  case menuBuilder.ChatEventType.reply:
93
+ case menuBuilder.ChatEventType.doctorAsk:
91
94
  status = 2
92
95
  nullTip = '请补充需要回复的内容'
93
96
  break
97
+ case menuBuilder.ChatEventType.dAddSupply:
98
+ status = 200
99
+ nullTip = '请补充资料'
100
+ break
94
101
  }
95
102
 
96
103
  var params = {}
@@ -104,6 +111,12 @@ module.exports = Behavior({
104
111
  'actionSource': 'wxdoctor',
105
112
  'status': status,
106
113
  }
114
+
115
+ if (this.isRequest()) {
116
+ body['role'] = 1
117
+ body['userid'] = this.data.order.doctorid
118
+ }
119
+
107
120
  if (type == menuBuilder.ChatEventType.eAddSupply) {
108
121
  body['showDoctor'] = true
109
122
  }
@@ -119,7 +132,9 @@ module.exports = Behavior({
119
132
  }
120
133
  })
121
134
  body['caseImageList'] = sendMediaFiles
135
+
122
136
  }
137
+
123
138
  if (body['comments'] == '' && (body['contentSound'] == null || body['contentSound'] == '') && body['caseImageList'] == null) {
124
139
  wx.showToast({
125
140
  icon: null,
@@ -130,6 +145,9 @@ module.exports = Behavior({
130
145
  wx.showLoading({
131
146
  title: '保存中...',
132
147
  })
148
+
149
+ console.error(JSON.stringify(body))
150
+
133
151
  api.requestReply(type, params, body).then((res) => {
134
152
  wx.hideLoading()
135
153
  if (res.status == 200 && res.data) {
@@ -179,5 +197,9 @@ module.exports = Behavior({
179
197
  }
180
198
  this._toRecordAudio()
181
199
  },
200
+
201
+ isRequest() {
202
+ return cache.doctorId() == this.data.order.doctorid
203
+ },
182
204
  }
183
205
  })
@@ -1,6 +1,6 @@
1
1
  function cache(data) {
2
2
  var doctorOptions = wx.doctorOptions || {}
3
- if (data.doctorId && data.doctorId !== null && data.doctorId !== '') {
3
+ if (data.doctorId && data.doctorId != null && data.doctorId != '') {
4
4
  generateSessionId()
5
5
  }
6
6
  // if (data.doctor != null) {
@@ -36,7 +36,7 @@ function _request(request, method, params, data) {
36
36
  fullParams.sdkProductId = appConfig.appID
37
37
  fullParams.pid = appConfig.appID
38
38
  fullParams.app_version = appConfig.appVersion
39
- fullParams.actionSource = 'wxApp'
39
+ fullParams.actionSource = 'wxdoctor'
40
40
  fullParams.device_token = ''
41
41
  if (doctorId) {
42
42
  fullParams.doctor_id = doctorId
@@ -68,6 +68,11 @@ function _request(request, method, params, data) {
68
68
  'CurTime': curTime,
69
69
  'CheckSum': checkSum
70
70
  }
71
+
72
+ if (data && !data.actionSource) {
73
+ data['actionSource'] = 'wxdoctor'
74
+ }
75
+
71
76
  if (request.download) {
72
77
  wx.downloadFile({
73
78
  url: url,
@@ -158,17 +158,38 @@ function showPermissionTip(error, ...scopes) {
158
158
  }
159
159
 
160
160
  function subscriptionVideoTime() {
161
- wx.requestSubscribeMessage({
162
- tmplIds: ['wsBcrNpvBt8a8pneIRNY8JdHKXYxhHxjONrelT8K5zQ'],
163
- success: (res) => {
164
- wx.showToast({
165
- title: '订阅成功',
166
- })
167
- },
168
- fail: (error) => {
169
- wx.showToast({
170
- title: error,
171
- })
161
+ const id = 'D8X5Vg3T0MmqA_uie9kyTEmfUoaHreWq4d9KoeM1UCg'
162
+ wx.getSetting({
163
+ withSubscriptions: true,
164
+ success(res) {
165
+ // console.log(res)
166
+ if (res.subscriptionsSetting.mainSwitch) { // 用户打开了订阅消息总开关
167
+ if (res.subscriptionsSetting.itemSettings) { // 用户同意总是保持是否推送消息的选择, 这里表示以后不会再拉起推送消息的授权
168
+ let moIdState = res.subscriptionsSetting.itemSettings[id]; // 用户同意的消息模板id
169
+ if (moIdState === 'accept') {
170
+ // console.log('接受了消息推送');
171
+ } else if (moIdState === 'reject') {
172
+ // console.log('拒绝了消息推送');
173
+ wx.requestSubscribeMessage({
174
+ tmplIds: [id],
175
+ success(res) {},
176
+ })
177
+ } else if (moIdState === 'ban') {
178
+ // console.log("已被后台封禁");
179
+ }
180
+ } else {
181
+ wx.requestSubscribeMessage({
182
+ tmplIds: [id],
183
+ success(res) {},
184
+ })
185
+ }
186
+ }
187
+ // else {
188
+ // wx.openSetting({
189
+ // withSubscriptions: true,
190
+ // })
191
+
192
+ // }
172
193
  }
173
194
  })
174
195
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-doctor-sdk",
3
- "version": "0.2.9",
3
+ "version": "0.3.1",
4
4
  "description": "和缓名医小程序SDK",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"