checkAndAccept.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="">
  3. <uni-popup ref="popup" type="share" backgroundColor="#fff">
  4. <view class="select-container">
  5. <view class="title">
  6. <text class="btn cancel" @tap="close">取消</text>
  7. 验收
  8. <text class="btn confirm" @tap="submit">确定</text>
  9. </view>
  10. <uni-forms :modelValue="formData" class="form" label-width='75px'>
  11. <uni-forms-item label="验收人" name="accepterUserId">
  12. <uni-data-select v-model="formData.accepterUserId" @change="handleChange" :clear="false"
  13. :localdata="contactInfoVOS"></uni-data-select>
  14. </uni-forms-item>
  15. <uni-forms-item label="验收状态" name="accepterStatus">
  16. <uni-data-select v-model="formData.accepterStatus" :clear="false"
  17. :localdata="stateLiist"></uni-data-select>
  18. </uni-forms-item>
  19. <uni-forms-item label="验收意见" name="accepterRemark">
  20. <textarea class="textarea" type="text" v-model="formData.accepterRemark" placeholder="验收意见" />
  21. </uni-forms-item>
  22. <PhotoBtn ref="photoRef" />
  23. </uni-forms>
  24. </view>
  25. <u-toast ref="uToast"></u-toast>
  26. </uni-popup>
  27. </view>
  28. </template>
  29. <script>
  30. import PhotoBtn from './PhotoBtn.vue';
  31. import {
  32. getSalesWorkOrderById,
  33. checkAndAccept
  34. } from '@/api/salesServiceManagement/workOrder/index.js'
  35. export default {
  36. components: {
  37. PhotoBtn
  38. },
  39. data() {
  40. return {
  41. acceptShow: false,
  42. formData: {
  43. accepterUserId: '',
  44. accepterUserName: '',
  45. accepterRemark: '',
  46. accepterStatus: '',
  47. id: ''
  48. },
  49. contactInfoVOS: [],
  50. stateLiist: [{
  51. value: 1,
  52. text: '通过'
  53. },
  54. {
  55. value: 0,
  56. text: '不通过'
  57. }
  58. ],
  59. }
  60. },
  61. methods: {
  62. open(id) {
  63. this.acceptShow = true;
  64. this.$refs.popup.open();
  65. this.formData = {
  66. accepterUserId: '',
  67. accepterUserName: '',
  68. accepterRemark: '',
  69. accepterStatus: '',
  70. id,
  71. }
  72. this.getDadaList(id);
  73. console.log(this.formData, 'fffffm')
  74. },
  75. async getDadaList(id) {
  76. const {
  77. afterSalesDemandVO
  78. } = await getSalesWorkOrderById(id);
  79. this.contactInfoVOS = afterSalesDemandVO.contactInfoVOS || [];
  80. this.contactInfoVOS.map((el) => {
  81. el.value = el.id;
  82. el.text = el.contactName;
  83. })
  84. console.log(this.contactInfoVOS, 'contactInfoVOS')
  85. },
  86. handleChange(e) {
  87. this.accepterUserName = this.contactInfoVOS.find(el => el.id == e).contactName
  88. },
  89. submit() {
  90. if (!this.formData.accepterUserId) {
  91. this.$refs.uToast.show({
  92. type: "warning",
  93. message: "请选择验收人",
  94. })
  95. return;
  96. }
  97. if (!this.formData.accepterStatus) {
  98. this.$refs.uToast.show({
  99. type: "warning",
  100. message: "请选择验收状态",
  101. })
  102. return;
  103. }
  104. let accepterImageUrl = this.$refs.photoRef.getImageData();
  105. let data = {
  106. ...this.formData,
  107. accepterImageUrl
  108. }
  109. uni.showLoading({
  110. title: '加载中'
  111. })
  112. checkAndAccept(data).then((res) => {
  113. this.$emit('getList');
  114. this.close();
  115. uni.hideLoading();
  116. }).then((err) => {
  117. uni.hideLoading();
  118. })
  119. },
  120. close() {
  121. this.$refs.popup.close();
  122. }
  123. }
  124. }
  125. </script>
  126. <style scoped lang="scss">
  127. .select-container {
  128. min-height: 60vh;
  129. .title {
  130. display: flex;
  131. justify-content: space-between;
  132. align-items: center;
  133. height: 100rpx;
  134. line-height: 100rpx;
  135. text-align: center;
  136. background-color: $j-primary-border-green;
  137. font-weight: bold;
  138. padding: 0 20rpx;
  139. position: relative;
  140. font-size: 32rpx;
  141. color: #fff;
  142. .btn {
  143. width: 80rpx;
  144. height: 32rpx;
  145. display: inline-block;
  146. font-size: 30rpx;
  147. border: 1px solid #fff;
  148. text-align: center;
  149. line-height: 30rpx;
  150. margin: 0;
  151. }
  152. }
  153. .form {
  154. padding: 20rpx 14rpx 0;
  155. /deep/ .uni-forms-item__label {
  156. font-size: 28rpx;
  157. }
  158. .textarea {
  159. border: 1px solid #ddd;
  160. }
  161. }
  162. }
  163. </style>