satisfaction_evaluation.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view class="satisfaction_evaluation">
  3. <template v-if="itemList.length>0">
  4. <view class="checklist" v-for="(checklist,idx) in itemList" :key="idx">
  5. <view class="title">{{checklist.itemTitle}}</view>
  6. <view class="item-cont" v-if="checklist.children&&checklist.children.length>0">
  7. <view class="checklistItem" v-for="(checklistItem,itemIdx) in checklist.children" :key="itemIdx">
  8. <view class="itemTitle">{{checklistItem.itemTitle}}</view>
  9. <view class="point-cont" v-if="checklistItem.pointList&&checklistItem.pointList.length>0">
  10. <view class="point" v-for="(point,pointIdx) in checklistItem.pointList" :key="pointIdx">
  11. <view class="pointContent">{{point.pointContent}}</view>
  12. <uni-rate v-model="point.score" @change="changePointRate(point)" />
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. <uni-card margin="0">
  19. <uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="80">
  20. <uni-forms-item label="卡号" name="cardNo" required>
  21. <uni-easyinput v-model="formData.cardNo" placeholder="请填写卡号" />
  22. </uni-forms-item>
  23. <uni-forms-item label="手机号码" name="phoneNumber">
  24. <uni-easyinput v-model="formData.phoneNumber" placeholder="手机号码" />
  25. </uni-forms-item>
  26. <uni-forms-item label="备注" name="remark">
  27. <uni-easyinput v-model="formData.remark" type="textarea" :maxlength="-1" autoHeight placeholder="备注" />
  28. </uni-forms-item>
  29. </uni-forms>
  30. <button type="primary" @click="onSubmit" class="submit-BT">提交</button>
  31. </uni-card>
  32. </template>
  33. <template v-else>没有可处理的清单^-_-^</template>
  34. </view>
  35. </template>
  36. <script>
  37. import {getSatisfactionChecklist,batchSatisfactionChecklist} from '@/api/aqpt/checklist.js'
  38. export default {
  39. data() {
  40. return {
  41. itemList:[],
  42. pointList:[],
  43. formData:{
  44. phoneNumber:"",
  45. cardNo:""
  46. },
  47. rules:{
  48. cardNo:{
  49. rules:[{
  50. required: true,
  51. errorMessage: '请填写卡号',
  52. },]
  53. }
  54. },
  55. qrcode:{},
  56. unionid:undefined,
  57. checklistId:undefined,
  58. checklistTitle:undefined
  59. }
  60. },
  61. onReady() {
  62. this.$refs.form.setRules(this.rules)
  63. },
  64. onLoad({id}) {
  65. this.unionid=uni.getStorageSync('unionid')
  66. let qrcode=uni.getStorageSync('qrcode')
  67. this.checklistId=id;
  68. this.qrcode=qrcode;
  69. this.getView()
  70. },
  71. methods: {
  72. getView(){
  73. getSatisfactionChecklist(this.checklistId).then((res)=>{
  74. this.itemList=res.data.itemList
  75. this.checklistTitle=res.data.checklistTitle
  76. })
  77. },
  78. changePointRate(point){
  79. let idx=-1;
  80. for(let i=0;i<this.pointList.length;i++){
  81. if(this.pointList[i].pointId===point.pointId){
  82. idx=i
  83. }
  84. }
  85. if(idx===-1){
  86. this.pointList.push(point)
  87. }else{
  88. this.pointList[idx]=point
  89. }
  90. },
  91. onSubmit(){
  92. let recordList=JSON.parse(JSON.stringify(this.pointList))
  93. this.$refs.form.validate().then(res=>{
  94. batchSatisfactionChecklist({
  95. wxId:this.unionid,
  96. wxName:"微信用户",
  97. phoneNumber:this.formData.phoneNumber,
  98. checklistId:this.checklistId,
  99. checklistTitle:this.checklistTitle,
  100. targetId:this.qrcode.targetId,
  101. targetType:this.qrcode.targetType,
  102. targetTitle:this.qrcode.riskPointTitle,
  103. targetGroupId:this.qrcode.groupId,
  104. targetGroupName:this.qrcode.groupName,
  105. remark:this.formData.remark,
  106. recordList:recordList
  107. }).then((res)=>{
  108. uni.showToast({
  109. icon:"none",
  110. mask:true,
  111. title:'评价成功'
  112. })
  113. uni.$emit('type',3)
  114. uni.switchTab({
  115. url:'/pages/history/history'
  116. })
  117. })
  118. }).catch(err =>{
  119. uni.showToast({
  120. icon:"none",
  121. title:'表单信息错误'
  122. })
  123. })
  124. }
  125. }
  126. }
  127. </script>
  128. <style lang="scss" scoped>
  129. .satisfaction_evaluation{
  130. padding: 20rpx;
  131. margin-bottom: 100rpx;
  132. .checklist{
  133. .title{
  134. color: #333;
  135. font-size: 36rpx;
  136. height: 60rpx;
  137. line-height: 60rpx;
  138. }
  139. .item-cont{
  140. padding-left: 20rpx;
  141. .checklistItem{
  142. .itemTitle{
  143. color: #424242;
  144. font-size: 32rpx;
  145. line-height: 1;
  146. padding: 10rpx 0;
  147. }
  148. }
  149. .point-cont{
  150. padding-left: 30rpx;
  151. .point{
  152. display: flex;
  153. color: #666;
  154. font-size: 28rpx;
  155. line-height: 1;
  156. padding: 10rpx 0;
  157. .pointContent{
  158. flex: 1;
  159. }
  160. }
  161. }
  162. }
  163. }
  164. .submit-BT {
  165. height: 72rpx;
  166. line-height: 72rpx;
  167. text-align: center;
  168. background:#3D90F4;
  169. border-radius: 42rpx;
  170. font-size: 32rpx;
  171. font-family: PingFang SC;
  172. font-weight: 400;
  173. color: #FFFFFF;
  174. margin: 50rpx auto;
  175. }
  176. }
  177. </style>