finish.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <view class="container">
  3. <view class="mim-view">
  4. <view class="mim-font-16 bold mim-flex-wrap-left">
  5. <text class="mim-font-16 bold">完成日期</text>
  6. <text class="mim-font-16 bold mimRed">*</text>
  7. </view>
  8. <view class="select">
  9. <u-input
  10. type="select"
  11. v-model="form.complain_date"
  12. placeholder="请选择完成的日期"
  13. placeholder-style="color: #BDBDBD;"
  14. height="96"
  15. cursor-spacing="12"
  16. :clearable="false"
  17. disabled
  18. :custom-style="customStyle"
  19. @click="show = true"
  20. />
  21. <u-image src="@/static/icon/jt.png" class="select_img" width="64rpx" height="64rpx"></u-image>
  22. <u-calendar v-model="show" mode="date" @change="change"></u-calendar>
  23. </view>
  24. </view>
  25. <view class="mim-view" style="margin-top: -24rpx">
  26. <view class="mim-font-16 bold mim-flex-wrap-left">
  27. <text class="mim-font-16 bold">完成意见</text>
  28. <text class="mim-font-16 bold mimRed">*</text>
  29. </view>
  30. <u-input
  31. type="textarea"
  32. v-model="form.deal_idea"
  33. placeholder="请填写你的完成意见"
  34. placeholder-style="color: #BDBDBD;"
  35. height="240"
  36. :auto-height="true"
  37. :clearable="false"
  38. :custom-style="customTestStyle"
  39. maxlength="-1"
  40. cursor-spacing="12"
  41. />
  42. </view>
  43. <view class="mim-view">
  44. <text class="mim-font-16 bold">附件上传</text>
  45. <view class="wrap">
  46. <view class="mim-flex-wrap-left">
  47. <u-upload
  48. :custom-btn="true"
  49. ref="uUpload"
  50. :auto-upload="true"
  51. :show-upload-list="showUploadList"
  52. :max-size="20 * 1024 * 1024"
  53. max-count="9"
  54. :action="action"
  55. :form-data="formData"
  56. :header="header"
  57. accept="video"
  58. >
  59. <view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
  60. <view class="mim-flex-vertical-center">
  61. <u-image src="@/static/icon/camera.png" width="40rpx" height="40rpx"></u-image>
  62. <view class="uploading_test">上传文件</view>
  63. </view>
  64. </view>
  65. </u-upload>
  66. <view class="pre-box" v-if="!showUploadList">
  67. <view class="pre-item" v-for="(item, index) in lists" :key="index">
  68. <view style="position: relative">
  69. <image class="pre-item-image" :src="item.url" mode="aspectFill" @click="previewImage(index)"></image>
  70. <u-image src="@/static/icon/cuo.png" mode="widthFix" class="cha" @click="deleteImage(index)"></u-image>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="mim-view mim-flex-wrap-space-between" style="margin-top: 24rpx; padding-bottom: 200rpx">
  78. <view class="mim-font-16 bold mim-flex-wrap-left">
  79. <text class="mim-font-16 bold">群众满意度</text>
  80. <text class="mim-font-16 bold mimRed">*</text>
  81. </view>
  82. <view>
  83. <u-number-box v-model="form.deal_evaluation" bg-color="#f7f7f7" :min="0" :max="100" @change="valChange"></u-number-box>
  84. </view>
  85. </view>
  86. <view class="mim-view-list"></view>
  87. <view class="mim-view-last"></view>
  88. <view class="mim-foot">
  89. <view class="mim-foot-button mim-flex-wrap mim-button" :class="{ disabled: isButtonDisabled }" @click="save">确定</view>
  90. </view>
  91. <UserPrivacy ref="privacy"></UserPrivacy>
  92. </view>
  93. </template>
  94. <script>
  95. import UserPrivacy from '@/components/userPrivacy/userPrivacy.vue';
  96. import { prodUrl } from '@/common/settings.js';
  97. export default {
  98. components: {
  99. UserPrivacy
  100. },
  101. data() {
  102. return {
  103. customStyle: {
  104. marginTop: '24rpx',
  105. fontSize: '32rpx',
  106. paddingLeft: '24rpx',
  107. background: '#f7f7f7',
  108. borderRadius: '8rpx'
  109. },
  110. customTestStyle: {
  111. 'box-sizing': 'border-box',
  112. marginTop: '24rpx',
  113. fontSize: '32rpx',
  114. padding: '32rpx 24rpx',
  115. background: '#f7f7f7',
  116. borderRadius: '8rpx'
  117. },
  118. show: false,
  119. form: {
  120. id: '',
  121. complain_date: '',
  122. deal_file_ids: [],
  123. deal_idea: '',
  124. deal_evaluation: 100
  125. },
  126. formData: {
  127. dir: 'file_account',
  128. file_type: 'file'
  129. },
  130. header: {
  131. Authorization: uni.getStorageSync('token')
  132. },
  133. action: prodUrl + '/base/resource/upload', //上传的地址
  134. showUploadList: false,
  135. lists: [],
  136. isButtonDisabled: false // 按钮是否禁用
  137. };
  138. },
  139. onLoad(e) {
  140. this.form.id = e.id;
  141. this.$refs.privacy.getPrivacySettingFn();
  142. wx.onNeedPrivacyAuthorization((resolve, eventInfo) => {
  143. console.log('触发本次事件的接口是:' + eventInfo.referrer);
  144. this.$refs.privacy.getPrivacySettingFn();
  145. resolve({ event: 'disagree' });
  146. });
  147. },
  148. onReady() {
  149. this.lists = this.$refs.uUpload.lists;
  150. },
  151. methods: {
  152. //放大图片查看
  153. previewImage(index) {
  154. const urls = this.lists.map((item) => item.url);
  155. const current = urls[index]; // 当前显示的图片地址
  156. uni.previewImage({
  157. current: current, // 当前显示的图片地址
  158. urls: urls // 图片地址数组
  159. });
  160. },
  161. change(e) {
  162. console.log(e);
  163. this.form.complain_date = e.result;
  164. },
  165. valChange(e) {
  166. this.form.deal_evaluation = e.value;
  167. },
  168. //删除图片
  169. deleteImage(index) {
  170. this.show = true;
  171. this.confirmDel(index);
  172. },
  173. confirmDel(index) {
  174. this.show = false;
  175. this.lists.splice(index, 1); //手动移除列表的某一个图片,index为lists数组的索引
  176. },
  177. save() {
  178. if (this.isButtonDisabled) {
  179. return false; // 如果按钮已禁用,直接返回
  180. }
  181. if (!this.form.complain_date) {
  182. this.$u.toast('请选择完成日期!');
  183. return false;
  184. }
  185. if (!this.form.deal_idea) {
  186. this.$u.toast('请填写完成意见!');
  187. return false;
  188. }
  189. this.form.deal_file_ids = this.lists.map((item) => item.response.data.id);
  190. console.log(this.form);
  191. this.isButtonDisabled = true; // 禁用按钮
  192. this.doCompleteFn();
  193. },
  194. //完成
  195. async doCompleteFn() {
  196. setTimeout(() => {
  197. this.isButtonDisabled = false; // 启用按钮
  198. }, 500);
  199. const res = await this.$u.api.doComplete(this.form);
  200. if (res.status === 'success') {
  201. this.$u.toast(res.message);
  202. setTimeout(() => {
  203. this.$u.route({
  204. type: 'navigateBack',
  205. url: '/pages/throughTrain/throughTrainDetails'
  206. });
  207. }, 1500);
  208. }
  209. }
  210. }
  211. };
  212. </script>
  213. <style lang="scss">
  214. page {
  215. background-color: #f7f7f7;
  216. .container {
  217. .mim-view {
  218. margin: 0;
  219. border-radius: 0;
  220. u-input {
  221. /deep/ .u-input__right-icon {
  222. display: none !important;
  223. }
  224. }
  225. .select {
  226. position: relative;
  227. .select_img {
  228. position: absolute;
  229. right: 0;
  230. top: 38rpx;
  231. }
  232. }
  233. .wrap {
  234. margin-top: 24rpx;
  235. }
  236. .slot-btn {
  237. width: 144rpx;
  238. height: 144rpx;
  239. display: flex;
  240. justify-content: center;
  241. align-items: center;
  242. background: #ffffff;
  243. box-sizing: border-box;
  244. border: 2px dashed #dbdbdb;
  245. margin-bottom: 20rpx;
  246. }
  247. .slot-btn__hover {
  248. background-color: rgb(235, 236, 238);
  249. }
  250. .uploading_test {
  251. font-size: 24rpx;
  252. font-weight: normal;
  253. line-height: 24rpx;
  254. letter-spacing: 0em;
  255. color: #dbdbdb;
  256. margin-top: 20rpx;
  257. }
  258. .pre-box {
  259. display: flex;
  260. align-items: center;
  261. // justify-content: space-between;
  262. flex-wrap: wrap;
  263. }
  264. .pre-item {
  265. width: 140rpx;
  266. height: 140rpx;
  267. overflow: hidden;
  268. position: relative;
  269. margin-left: 20rpx;
  270. margin-bottom: 20rpx;
  271. }
  272. .pre-item-image {
  273. width: 100%;
  274. height: 140rpx;
  275. }
  276. .cha {
  277. position: absolute;
  278. height: 30rpx;
  279. width: 30rpx;
  280. right: 6rpx;
  281. top: 6rpx;
  282. }
  283. }
  284. .mim-view-last {
  285. padding: 56rpx;
  286. background: transparent;
  287. }
  288. .mim-foot {
  289. width: 100%;
  290. height: 136rpx;
  291. position: fixed;
  292. bottom: 0;
  293. left: 0;
  294. background-color: #ffffff;
  295. padding: 20rpx 24rpx;
  296. box-sizing: border-box;
  297. z-index: 9;
  298. &-button {
  299. border-radius: 48rpx;
  300. opacity: 1;
  301. background: #de2e27;
  302. font-size: 32rpx;
  303. font-weight: normal;
  304. line-height: 32rpx;
  305. letter-spacing: 0px;
  306. color: #ffffff;
  307. height: 96rpx;
  308. cursor: pointer;
  309. }
  310. }
  311. }
  312. }
  313. </style>