satisfaction_evaluation.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. wxCode:this.unionid,
  118. wxName:"微信用户",
  119. phoneNumber:this.formData.phoneNumber,
  120. checklistId:this.checklistId,
  121. checklistTitle:this.checklistTitle,
  122. targetId:this.qrcode.targetId,
  123. targetType:this.qrcode.targetType,
  124. targetTitle:this.qrcode.riskPointTitle,
  125. targetGroupId:this.qrcode.groupId,
  126. targetGroupName:this.qrcode.groupName,
  127. remark:this.formData.remark,
  128. recordList:recordList
  129. }).then((res)=>{
  130. uni.showToast({
  131. icon:"none",
  132. mask:true,
  133. title:'评价成功'
  134. })
  135. uni.$emit('type',3)
  136. uni.switchTab({
  137. url:'/pages/history/history'
  138. })
  139. })
  140. }).catch(err =>{
  141. uni.showToast({
  142. icon:"none",
  143. title:'表单信息错误'
  144. })
  145. })
  146. }
  147. }
  148. }
  149. </script>
  150. <style lang="scss" scoped>
  151. .page{
  152. background-color: #F5F6F8;
  153. padding: 20rpx;
  154. }
  155. .satisfaction_evaluation{
  156. padding: 20rpx;
  157. margin-bottom: 60rpx;
  158. background-color: #fff;
  159. min-height: 100vh;
  160. box-sizing: border-box;
  161. .checklist{
  162. .title{
  163. color: #222222;
  164. font-size: 32rpx;
  165. height: 98rpx;
  166. line-height: 98rpx;
  167. border-bottom: 1px dashed #E8E8E8;
  168. }
  169. .more{
  170. background-image: url('/static/tree_more.png');
  171. background-size: 30rpx 30rpx;
  172. padding-left: 40rpx;
  173. background-position: center left;
  174. background-repeat: no-repeat;
  175. }
  176. .item-cont{
  177. padding-left: 20rpx;
  178. border-bottom: 1px dashed #E8E8E8;
  179. .checklistItem{
  180. .itemTitle{
  181. color: #222222;
  182. font-size: 32rpx;
  183. height: 98rpx;
  184. line-height: 98rpx;
  185. }
  186. }
  187. .point-cont{
  188. padding-left: 30rpx;
  189. .point{
  190. display: flex;
  191. color: #222222;
  192. font-size: 28rpx;
  193. height: 98rpx;
  194. line-height: 98rpx;
  195. align-items: center;
  196. .pointContent{
  197. flex: 1;
  198. }
  199. }
  200. }
  201. }
  202. }
  203. .form-wrap{
  204. margin-top: 100rpx;
  205. }
  206. .pagemask{
  207. position: fixed;
  208. left: 0;
  209. right: 0;
  210. top: 0;
  211. bottom: 0;
  212. background-color: rgba(255,255,255,0.1);
  213. z-index: 99;
  214. }
  215. .submit-BT {
  216. width: 750rpx;
  217. color: #4D73FF;
  218. text-align: center;
  219. font-size: 32rpx;
  220. padding-bottom: 68rpx;
  221. background-color: #fff;
  222. position: fixed;
  223. left: 0;
  224. bottom: 0;
  225. z-index: 99;
  226. box-shadow: 0px 0px 12px 0px #0000000A;
  227. border-radius: 8px 8px 0px 0px
  228. }
  229. }
  230. </style>