satisfaction_evaluation.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <view class="page">
  3. <view class="satisfaction_evaluation">
  4. <template v-if="itemList.length>0">
  5. <view class="checklist" v-for="(checklist,idx) in itemList" :key="idx">
  6. <view class="title more">{{checklist.itemTitle}}</view>
  7. <view class="item-cont" v-if="checklist.children&&checklist.children.length>0">
  8. <view class="checklistItem" v-for="(checklistItem,itemIdx) in checklist.children" :key="itemIdx">
  9. <view class="itemTitle more">{{checklistItem.itemTitle}}</view>
  10. <template v-if="type==='app'">
  11. <view class="point-cont" v-if="checklistItem.pointList&&checklistItem.pointList.length>0">
  12. <view class="point" v-for="(point,pointIdx) in checklistItem.pointList" :key="pointIdx">
  13. <view class="pointContent">{{point.pointContent}}</view>
  14. <uni-rate v-model="point.score" @change="changePointRate(point)" />
  15. </view>
  16. </view>
  17. </template>
  18. <template v-if="type==='history'">
  19. <view class="point-cont" v-if="checklistItem.recordList&&checklistItem.recordList.length>0">
  20. <view class="point" v-for="(point,pointIdx) in checklistItem.recordList" :key="pointIdx">
  21. <view class="pointContent">{{point.pointContent}}</view>
  22. <uni-rate v-model="point.score" />
  23. </view>
  24. </view>
  25. </template>
  26. </view>
  27. </view>
  28. <view class="pagemask" v-if="type==='history'"></view>
  29. </view>
  30. <view class="form-wrap">
  31. <uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="300" label-position="top">
  32. <uni-forms-item label="备注" name="remark">
  33. <uni-easyinput v-model="formData.remark" type="textarea" :maxlength="-1" autoHeight placeholder="备注" />
  34. </uni-forms-item>
  35. </uni-forms>
  36. <button v-if="type==='app'" type="primary" @click="onSubmit" class="submit-BT">提交</button>
  37. </view>
  38. </template>
  39. <template v-else>没有可处理的清单^-_-^</template>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import {getScoreView,getScoreRecordView,batchSatisfactionChecklist} from '@/api/aqpt/checklistScore.js'
  45. export default {
  46. data() {
  47. return {
  48. type:'app',
  49. itemList:[],
  50. pointList:[],
  51. formData:{
  52. phoneNumber:"",
  53. cardNo:"",
  54. remark:""
  55. },
  56. rules:{
  57. cardNo:{
  58. rules:[{
  59. required: true,
  60. errorMessage: '请填写卡号',
  61. },]
  62. }
  63. },
  64. qrcode:{},
  65. unionid:undefined,
  66. checklistId:undefined,
  67. checklistTitle:undefined
  68. }
  69. },
  70. onReady() {
  71. this.$nextTick(()=>{
  72. this.$refs.form?.setRules(this.rules)
  73. })
  74. },
  75. onLoad({id,recordId,type}) {
  76. this.unionid=uni.getStorageSync('unionid')
  77. let qrcode=uni.getStorageSync('qrcode')
  78. this.checklistId=id;
  79. this.qrcode=qrcode;
  80. this.recordId=recordId
  81. this.type=type;
  82. this.getView(type)
  83. },
  84. methods: {
  85. getView(type){
  86. if(type==='app'){
  87. getScoreView(this.checklistId).then((res)=>{
  88. this.itemList=res.data.itemList
  89. this.checklistTitle=res.data.checklistTitle
  90. })
  91. }else{
  92. getScoreRecordView(this.recordId,this.checklistId).then((res)=>{
  93. this.itemList=res.data.itemList
  94. this.checklistTitle=res.data.checklistTitle
  95. this.formData.remark=res.data.remark
  96. })
  97. }
  98. },
  99. changePointRate(point){
  100. let idx=-1;
  101. for(let i=0;i<this.pointList.length;i++){
  102. if(this.pointList[i].pointId===point.pointId){
  103. idx=i
  104. }
  105. }
  106. if(idx===-1){
  107. this.pointList.push(point)
  108. }else{
  109. this.pointList[idx]=point
  110. }
  111. },
  112. onSubmit(){
  113. let recordList=JSON.parse(JSON.stringify(this.pointList))
  114. this.$refs.form.validate().then(res=>{
  115. batchSatisfactionChecklist({
  116. wxId:this.unionid,
  117. wxName:"微信用户",
  118. phoneNumber:this.formData.phoneNumber,
  119. checklistId:this.checklistId,
  120. checklistTitle:this.checklistTitle,
  121. targetId:this.qrcode.targetId,
  122. targetType:this.qrcode.targetType,
  123. targetTitle:this.qrcode.riskPointTitle,
  124. targetGroupId:this.qrcode.groupId,
  125. targetGroupName:this.qrcode.groupName,
  126. remark:this.formData.remark,
  127. recordList:recordList
  128. }).then((res)=>{
  129. uni.showToast({
  130. icon:"none",
  131. mask:true,
  132. title:'评价成功'
  133. })
  134. uni.$emit('type',3)
  135. uni.switchTab({
  136. url:'/pages/history/history'
  137. })
  138. })
  139. }).catch(err =>{
  140. uni.showToast({
  141. icon:"none",
  142. title:'表单信息错误'
  143. })
  144. })
  145. }
  146. }
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. .page{
  151. background-color: #F5F6F8;
  152. padding: 20rpx;
  153. }
  154. .satisfaction_evaluation{
  155. padding: 20rpx;
  156. margin-bottom: 60rpx;
  157. background-color: #fff;
  158. min-height: 100vh;
  159. box-sizing: border-box;
  160. .checklist{
  161. .title{
  162. color: #222222;
  163. font-size: 32rpx;
  164. height: 98rpx;
  165. line-height: 98rpx;
  166. border-bottom: 1px dashed #E8E8E8;
  167. }
  168. .more{
  169. background-image: url('/static/tree_more.png');
  170. background-size: 30rpx 30rpx;
  171. padding-left: 40rpx;
  172. background-position: center left;
  173. background-repeat: no-repeat;
  174. }
  175. .item-cont{
  176. padding-left: 20rpx;
  177. border-bottom: 1px dashed #E8E8E8;
  178. .checklistItem{
  179. .itemTitle{
  180. color: #222222;
  181. font-size: 32rpx;
  182. height: 98rpx;
  183. line-height: 98rpx;
  184. }
  185. }
  186. .point-cont{
  187. padding-left: 30rpx;
  188. .point{
  189. display: flex;
  190. color: #222222;
  191. font-size: 28rpx;
  192. height: 98rpx;
  193. line-height: 98rpx;
  194. align-items: center;
  195. .pointContent{
  196. flex: 1;
  197. }
  198. }
  199. }
  200. }
  201. }
  202. .form-wrap{
  203. margin-top: 100rpx;
  204. }
  205. .pagemask{
  206. position: fixed;
  207. left: 0;
  208. right: 0;
  209. top: 0;
  210. bottom: 0;
  211. background-color: rgba(255,255,255,0.1);
  212. z-index: 99;
  213. }
  214. .submit-BT {
  215. width: 750rpx;
  216. color: #4D73FF;
  217. text-align: center;
  218. font-size: 32rpx;
  219. padding-bottom: 68rpx;
  220. background-color: #fff;
  221. position: fixed;
  222. left: 0;
  223. bottom: 0;
  224. z-index: 99;
  225. box-shadow: 0px 0px 12px 0px #0000000A;
  226. border-radius: 8px 8px 0px 0px
  227. }
  228. }
  229. </style>