普兆健康管家前端代码仓库
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.

340 lines
8.7 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar title="申请售后" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#F3F2F7" />
  4. <view class="main">
  5. <view v-if="form.type != 2">
  6. <view class="product" v-for="item in applyServiceProduct" :key="item.id">
  7. <productCard :data="item" ></productCard>
  8. </view>
  9. </view>
  10. <uv-form
  11. ref="form"
  12. :model="form"
  13. :rules="rules"
  14. errorType="toast"
  15. >
  16. <view class="card info">
  17. <view class="card-header">申请信息</view>
  18. <!-- 其他 -->
  19. <template v-if="form.type == 2">
  20. <view class="form-item">
  21. <uv-form-item prop="remark" :customStyle="formItemStyle">
  22. <view class="form-item-label">备注</view>
  23. <view class="form-item-content">
  24. <formTextarea v-model="form.remark" height="436rpx"></formTextarea>
  25. </view>
  26. </uv-form-item>
  27. </view>
  28. </template>
  29. <!-- 退货退款, 换货 -->
  30. <template v-else>
  31. <view class="form-item">
  32. <uv-form-item prop="type" :customStyle="formItemStyle">
  33. <view class="form-item-label light">申请类型</view>
  34. <view class="form-item-content input type">
  35. {{ typeDesc }}
  36. </view>
  37. </uv-form-item>
  38. </view>
  39. <view class="form-item">
  40. <uv-form-item prop="reason" :customStyle="formItemStyle">
  41. <view class="form-item-label">申请原因</view>
  42. <view class="form-item-content input">
  43. <formInput v-model="form.reason" placeholder="请输入内容"></formInput>
  44. </view>
  45. </uv-form-item>
  46. </view>
  47. <view class="form-item">
  48. <uv-form-item prop="count" :customStyle="formItemStyle">
  49. <view class="flex row">
  50. <view class="form-item-label">退货数量</view>
  51. <view class="form-item-content count">
  52. <uv-number-box
  53. v-model="form.count"
  54. bgColor="transparent"
  55. :iconStyle="{
  56. background: '#FFFFFF',
  57. fontSize: '20rpx',
  58. lineHeight: 1,
  59. padding: '9px',
  60. borderRadius: '50%',
  61. }"
  62. ></uv-number-box>
  63. </view>
  64. </view>
  65. </uv-form-item>
  66. </view>
  67. <view class="form-item">
  68. <uv-form-item prop="amount" :customStyle="formItemStyle">
  69. <view class="form-item-label">申请金额</view>
  70. <view class="form-item-content input">
  71. <formInput v-model="form.amount" placeholder="请输入内容" type="number"></formInput>
  72. </view>
  73. </uv-form-item>
  74. </view>
  75. </template>
  76. <view class="form-item">
  77. <uv-form-item prop="images" :customStyle="formItemStyle">
  78. <view class="form-item-label">上传图片/视频选填</view>
  79. <view class="form-item-content upload">
  80. <formUpload v-model="form.images"></formUpload>
  81. </view>
  82. </uv-form-item>
  83. </view>
  84. </view>
  85. <view class="card phone">
  86. <view class="form-item">
  87. <uv-form-item prop="phone" :customStyle="formItemStyle">
  88. <view class="flex row">
  89. <view class="form-item-label">联系电话</view>
  90. <view class="form-item-content">
  91. <formInput v-model="form.phone" inputAlign="right"></formInput>
  92. </view>
  93. </view>
  94. </uv-form-item>
  95. </view>
  96. </view>
  97. </uv-form>
  98. </view>
  99. <view class="bottom">
  100. <button class="btn" @click="onSubmit">提交申请</button>
  101. </view>
  102. </view>
  103. </template>
  104. <script>
  105. import { mapState } from 'vuex'
  106. import productCard from './productCard.vue'
  107. import formInput from '@/pages_order/components/formInput.vue'
  108. import formTextarea from '@/pages_order/components/formTextarea.vue'
  109. import formUpload from '@/pages_order/components/formUpload.vue'
  110. export default {
  111. components: {
  112. productCard,
  113. formInput,
  114. formTextarea,
  115. formUpload,
  116. },
  117. data() {
  118. return {
  119. id: null,
  120. typeOptions: [
  121. {
  122. id: '001',
  123. label: '退货退款',
  124. value: 0,
  125. },
  126. {
  127. id: '002',
  128. label: '换货',
  129. value: 1,
  130. },
  131. {
  132. id: '003',
  133. label: '其他',
  134. value: 2,
  135. },
  136. ],
  137. form: {
  138. type: null,
  139. reason: null,
  140. count: 1,
  141. amount: null,
  142. images: [],
  143. phone: null,
  144. remark: null,
  145. },
  146. rules: {
  147. 'reason': {
  148. type: 'string',
  149. required: true,
  150. message: '请输入申请原因',
  151. },
  152. 'count': {
  153. type: 'number',
  154. required: true,
  155. message: '请输入退货数量',
  156. },
  157. 'amount': {
  158. type: 'number',
  159. required: true,
  160. message: '请输入申请金额(元)',
  161. },
  162. 'phone': {
  163. type: 'string',
  164. required: true,
  165. message: '联系电话',
  166. },
  167. 'remark': {
  168. type: 'string',
  169. required: true,
  170. message: '请输入备注',
  171. },
  172. },
  173. formItemStyle: { padding: 0 },
  174. }
  175. },
  176. computed: {
  177. ...mapState(['configList', 'userInfo', 'applyServiceProduct']),
  178. typeDesc() {
  179. const type = this.form.type
  180. return this.typeOptions.find(item => item.value === type)?.label
  181. },
  182. },
  183. onLoad(arg) {
  184. const { id, type } = arg
  185. this.id = id
  186. this.form.type = this.typeOptions.find(item => item.value == type)?.value
  187. },
  188. methods: {
  189. async onSubmit() {
  190. try {
  191. const res = await this.$refs.form.validate()
  192. console.log('onSubmit res', res)
  193. // todo
  194. setTimeout(() => {
  195. this.$utils.navigateBack()
  196. }, 800)
  197. } catch (err) {
  198. console.log('onSubmit err', err)
  199. }
  200. },
  201. },
  202. }
  203. </script>
  204. <style scoped lang="scss">
  205. .page__view {
  206. width: 100vw;
  207. min-height: 100vh;
  208. background-color: $uni-bg-color;
  209. position: relative;
  210. /deep/ .nav-bar__view {
  211. position: fixed;
  212. top: 0;
  213. left: 0;
  214. }
  215. }
  216. .main {
  217. padding: calc(var(--status-bar-height) + 144rpx) 32rpx 242rpx 32rpx;
  218. }
  219. .product {
  220. & + & {
  221. margin-top: 32rpx;
  222. }
  223. }
  224. .card {
  225. margin-top: 40rpx;
  226. padding: 32rpx;
  227. background: #FAFAFF;
  228. border: 2rpx solid #FFFFFF;
  229. border-radius: 32rpx;
  230. &-header {
  231. font-family: PingFang SC;
  232. font-weight: 500;
  233. font-size: 36rpx;
  234. line-height: 1.4;
  235. color: #252545;
  236. margin-bottom: 32rpx;
  237. }
  238. &.phone {
  239. padding-top: 28rpx;
  240. padding-bottom: 28rpx;
  241. }
  242. }
  243. .form {
  244. &-item {
  245. border-bottom: 2rpx solid #EEEEEE;
  246. &:last-child {
  247. border: none;
  248. }
  249. & + & {
  250. margin-top: 32rpx;
  251. }
  252. &-label {
  253. padding: 8rpx 0;
  254. font-family: PingFang SC;
  255. font-weight: 400;
  256. font-size: 26rpx;
  257. line-height: 1.4;
  258. color: #181818;
  259. &.light {
  260. color: #8B8B8B;
  261. }
  262. }
  263. &-content {
  264. &.input {
  265. padding: 6rpx 0;
  266. }
  267. &.upload,
  268. &.count {
  269. padding: 8rpx 0;
  270. }
  271. }
  272. .type {
  273. font-family: PingFang SC;
  274. font-weight: 400;
  275. font-size: 32rpx;
  276. line-height: 1.4;
  277. color: #393939;
  278. }
  279. }
  280. }
  281. .row {
  282. justify-content: space-between;
  283. }
  284. .bottom {
  285. position: fixed;
  286. left: 0;
  287. bottom: 0;
  288. z-index: 2;
  289. width: 100vw;
  290. height: 200rpx;
  291. padding: 24rpx 40rpx;
  292. background: #FFFFFF;
  293. box-sizing: border-box;
  294. .btn {
  295. width: 100%;
  296. padding: 16rpx 0;
  297. box-sizing: border-box;
  298. font-family: PingFang SC;
  299. font-weight: 500;
  300. font-size: 36rpx;
  301. line-height: 1;
  302. color: #FFFFFF;
  303. background-image: linear-gradient(to right, #4B348F, #845CFA);
  304. border-radius: 41rpx;
  305. }
  306. }
  307. </style>