艺易修小程序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.

236 lines
5.3 KiB

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