checkAndAccept.vue 3.6 KB

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