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

231 lines
5.1 KiB

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
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="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" safeAreaInsetBottom
  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.reLaunch({
  112. url: '/pages/order/order'
  113. })
  114. },
  115. //打开处理结果
  116. processingPickerOpen() {
  117. uni.hideKeyboard()
  118. this.$refs.processing.open();
  119. },
  120. //用户选择了处理结果
  121. floorConfirm(floor) {
  122. this.form.successTitle = floor.value[0].label
  123. },
  124. //上传图片
  125. uploadImage() {
  126. let self = this
  127. this.$Oss.ossUploadImage({
  128. success(res) {
  129. self.form.successImage.push(res)
  130. }
  131. })
  132. },
  133. //打开图片操作菜单
  134. openImageMenu(index) {
  135. this.currentIndex = index
  136. this.$refs.actionSheet.open();
  137. },
  138. //用户选择了图片操作选项
  139. selectImageSheet(imageSheet) {
  140. let {
  141. id
  142. } = imageSheet
  143. if (id) {
  144. this.deleteImageAsList()
  145. } else {
  146. this.viewImageAsList()
  147. }
  148. },
  149. //查看图片
  150. viewImageAsList() {
  151. this.$utils.previewImage({
  152. current: this.currentIndex,
  153. urls: this.form.successImage
  154. })
  155. },
  156. //删除图片
  157. deleteImageAsList() {
  158. this.form.successImage = this.form.successImage.filter((_, index) => {
  159. return index != this.currentIndex
  160. })
  161. },
  162. //结单
  163. submit() {
  164. this.$refs.form.validate().then(res => {
  165. this.$api('editSchoolOrderSuccess', { ...this.form , successImage : this.form.successImage.join(',') }, res => {
  166. if (res.code == 200) {
  167. uni.showToast({
  168. icon: 'none',
  169. title: '结单完成'
  170. })
  171. this.leftClick()
  172. }
  173. })
  174. }).catch(errors => {})
  175. }
  176. }
  177. }
  178. </script>
  179. <style>
  180. .finish {
  181. width: 96%;
  182. margin: 0rpx auto;
  183. }
  184. .image-list {
  185. width: 100%;
  186. display: flex;
  187. flex-wrap: wrap;
  188. padding-top: 20rpx;
  189. }
  190. .image-item,
  191. .upload {
  192. display: flex;
  193. align-items: center;
  194. justify-content: center;
  195. width: 24%;
  196. height: 174rpx;
  197. background: #f8f8f8;
  198. margin-left: 1%;
  199. border-radius: 15rpx;
  200. overflow: hidden;
  201. margin-bottom: 20rpx;
  202. ;
  203. }
  204. .image-item image {
  205. width: 100%;
  206. }
  207. /deep/ .uv-safe-area-inset-bottom {
  208. padding-bottom: 0 !important
  209. }
  210. </style>