艺易修小程序24.08.21
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

226 lines
5.0 KiB

8 months ago
8 months ago
8 months ago
7 months ago
7 months ago
8 months ago
7 months ago
7 months ago
8 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
  1. <!-- 结单 -->
  2. <template>
  3. <view class="finish">
  4. <!-- <navbar title="结单" :leftClick="leftClick"></navbar> -->
  5. <uv-form labelPosition="top" :model="form" errorType="toast" :rules="rules" ref="form" labelWidth="140">
  6. <uv-form-item label="处理结果" prop="successTitle">
  7. <uv-input @focus="processingPickerOpen" placeholder="请选择处理结果" v-model="form.successTitle"
  8. :fontSize="30"></uv-input>
  9. </uv-form-item>
  10. <uv-form-item label="收费金额" prop="successPrice">
  11. <uv-input placeholder="请输入收费金额" type="number" v-model="form.successPrice" :fontSize="30"></uv-input>
  12. </uv-form-item>
  13. <uv-form-item label="处理说明" prop="sucessText">
  14. <uv-textarea v-model="form.sucessText" :maxlength="200" :height="120" count
  15. placeholder="请输入处理说明"></uv-textarea>
  16. </uv-form-item>
  17. <uv-form-item label="照片" prop="successImage">
  18. <view class="image-list">
  19. <view @click="openImageMenu(index)" v-for="(item,index) in form.successImage" :key="index"
  20. class="image-item">
  21. <image :src="item" mode="widthFix"></image>
  22. </view>
  23. <view v-if="form.successImage.length < maxUpload" @click="uploadImage" class="upload">
  24. <uv-icon name="camera-fill" color="#3c9cff" size="50"></uv-icon>
  25. </view>
  26. </view>
  27. </uv-form-item>
  28. <uv-button type="primary" text="结单" shape="circle" customStyle="margin-top: 10px"
  29. @click="submit"></uv-button>
  30. <!-- 选择完成状态 -->
  31. <uv-picker ref="processing" :columns="processingList" :itemHeight="100" :round="20" keyName="label"
  32. title="选择处理结果" @confirm="floorConfirm"></uv-picker>
  33. <!-- 图片操作菜单 -->
  34. <uv-action-sheet ref="actionSheet" :actions="list" :round="20" cancelText="取消" title="图片操作"
  35. @select="selectImageSheet"> </uv-action-sheet>
  36. </uv-form>
  37. </view>
  38. </template>
  39. <script>
  40. import navbar from '../../components/base/navbar.vue'
  41. export default {
  42. name: 'Finish',
  43. components: {
  44. navbar
  45. },
  46. data() {
  47. return {
  48. form: {
  49. successTitle: '',
  50. successPrice: '',
  51. sucessText: '',
  52. successImage: []
  53. },
  54. rules: {
  55. successTitle: {
  56. type: 'string',
  57. required: true,
  58. message: '请选择处理结果',
  59. trigger: ['blur', 'change']
  60. },
  61. successPrice: {
  62. type: 'string',
  63. required: true,
  64. message: '请填写收费金额',
  65. trigger: ['blur', 'change']
  66. },
  67. sucessText: {
  68. type: 'string',
  69. required: true,
  70. message: '请输入处理说明',
  71. trigger: ['blur', 'change']
  72. },
  73. successImage: {
  74. type: 'array',
  75. required: true,
  76. message: '请上传图片',
  77. trigger: ['blur', 'change']
  78. },
  79. },
  80. processingList: [
  81. [{
  82. id: 0,
  83. label: '处理完成'
  84. },
  85. // {
  86. // id: 1,
  87. // label: '未处理'
  88. // }
  89. ]
  90. ],
  91. maxUpload: 4,
  92. currentIndex: 0,
  93. list: [ //图片操作菜单操作项
  94. {
  95. name: '查看图片',
  96. id: 0
  97. },
  98. {
  99. name: '删除图片',
  100. id: 1
  101. }
  102. ],
  103. }
  104. },
  105. onLoad: function(options) {
  106. this.form.id = options.orderId || ''
  107. },
  108. methods: {
  109. //返回
  110. leftClick() {
  111. uni.switchTab({
  112. url: '/pages/center/center'
  113. })
  114. },
  115. //打开处理结果
  116. processingPickerOpen() {
  117. this.$refs.processing.open();
  118. },
  119. //用户选择了处理结果
  120. floorConfirm(floor) {
  121. this.form.successTitle = floor.value[0].label
  122. },
  123. //上传图片
  124. uploadImage() {
  125. let self = this
  126. this.$Oss.ossUploadImage({
  127. success(res) {
  128. self.form.successImage.push(res)
  129. }
  130. })
  131. },
  132. //打开图片操作菜单
  133. openImageMenu(index) {
  134. this.currentIndex = index
  135. this.$refs.actionSheet.open();
  136. },
  137. //用户选择了图片操作选项
  138. selectImageSheet(imageSheet) {
  139. let {
  140. id
  141. } = imageSheet
  142. if (id) {
  143. this.deleteImageAsList()
  144. } else {
  145. this.viewImageAsList()
  146. }
  147. },
  148. //查看图片
  149. viewImageAsList() {
  150. this.$utils.previewImage({
  151. current: this.currentIndex,
  152. urls: this.form.images
  153. })
  154. },
  155. //删除图片
  156. deleteImageAsList() {
  157. this.form.images = this.form.images.filter((_, index) => {
  158. return index != this.currentIndex
  159. })
  160. },
  161. //结单
  162. submit() {
  163. this.$refs.form.validate().then(res => {
  164. this.$api('editSchoolOrderSuccess', { ...this.form , successImage : this.form.successImage.join(',') }, res => {
  165. if (res.code == 200) {
  166. uni.showToast({
  167. icon: 'none',
  168. title: '结单完成'
  169. })
  170. this.leftClick()
  171. }
  172. })
  173. }).catch(errors => {})
  174. }
  175. }
  176. }
  177. </script>
  178. <style>
  179. .finish {
  180. width: 96%;
  181. margin: 0rpx auto;
  182. }
  183. .image-list {
  184. width: 100%;
  185. display: flex;
  186. flex-wrap: wrap;
  187. padding-top: 20rpx;
  188. }
  189. .image-item,
  190. .upload {
  191. display: flex;
  192. align-items: center;
  193. justify-content: center;
  194. width: 24%;
  195. height: 174rpx;
  196. background: #f8f8f8;
  197. margin-left: 1%;
  198. border-radius: 15rpx;
  199. overflow: hidden;
  200. margin-bottom: 20rpx;
  201. ;
  202. }
  203. .image-item image {
  204. width: 100%;
  205. }
  206. </style>