SupplyDeclarationFrom.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view class="formbg">
  3. <view class="scrollview">
  4. <u--form :rules="rules" labelPosition="left" :model="form" ref="uForm">
  5. <u-form-item class="formItem" prop="businessName" :labelWidth="labelWidth" label="商品" borderBottom >
  6. <u--input :input-align="inputaligh" placeholder="填写供应商名称" v-model="form.supplierName" border="none" disabled ></u--input>
  7. </u-form-item>
  8. <view class="margin20"></view>
  9. <u-form-item class="formItem" prop="num" :labelWidth="labelWidth" label="商品数量" borderBottom >
  10. <u--input :input-align="inputaligh" placeholder="填写商品数量(个)" v-model="form.num" border="none" clearable ></u--input>
  11. </u-form-item>
  12. <view class="margin20"></view>
  13. <u-form-item class="formItem" prop="price" :labelWidth="labelWidth" label="商品价格" borderBottom >
  14. <u--input :input-align="inputaligh" placeholder="填写商品价格(元)" v-model="form.price" border="none" clearable ></u--input>
  15. </u-form-item>
  16. <view class="margin20"></view>
  17. <u-form-item class="formItem" prop="contact" :labelWidth="labelWidth" label="联系人" borderBottom >
  18. <u--input :input-align="inputaligh" placeholder="请输入联系人" v-model="form.contact" border="none" clearable ></u--input>
  19. </u-form-item>
  20. <view class="margin20"></view>
  21. <u-form-item class="formItem" prop="phone" :labelWidth="labelWidth" label="联系电话" borderBottom >
  22. <u--input :input-align="inputaligh" placeholder="请输入联系电话" v-model="form.phone" border="none" clearable ></u--input>
  23. </u-form-item>
  24. </u--form>
  25. <view style="height: 100rpx;"></view>
  26. </view>
  27. <view class="btnbox" style="left: 24rpx;">
  28. <view @click="submit('submit')" class="btn2">
  29. 提交审核
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import {
  36. declareSupplier
  37. } from '@/http/api/common.js'
  38. export default {
  39. props: {
  40. selectData: {
  41. type: Object,
  42. default: null,
  43. },
  44. },
  45. data() {
  46. return {
  47. form:{
  48. "supplierId": "",
  49. "supplierName": "",
  50. "num": "",
  51. "price": "",
  52. "contact": "",
  53. "phone": "",
  54. },
  55. rules: {
  56. 'num': {
  57. type: 'string',
  58. required: true,
  59. message: '请填写数量',
  60. trigger: ['blur', 'change']
  61. },
  62. 'price': {
  63. type: 'string',
  64. required: true,
  65. message: '请填写价格',
  66. trigger: ['blur', 'change']
  67. },
  68. 'contact': {
  69. type: 'string',
  70. required: true,
  71. message: '请输入联系人',
  72. trigger: ['blur', 'change']
  73. },
  74. 'phone':[
  75. {
  76. type: 'string',
  77. required: true,
  78. message: '请输入联系电话',
  79. trigger: ['blur', 'change']
  80. },
  81. {
  82. validator: (rule, value, callback) => {
  83. return uni.$u.test.mobile(value);
  84. },
  85. message: '手机号码格式不正确',
  86. // 触发器可以同时用blur和change
  87. trigger: ['blur'],
  88. }
  89. ]
  90. },
  91. inputaligh:'right',
  92. labelWidth:140,
  93. popupShow:false,
  94. popupText:'',
  95. popupBtn:'上传营业执照',
  96. popupImgurl:'',
  97. cityShow:false,
  98. cityloading:false,
  99. cityColumns: [],
  100. columnData: [],
  101. categoryShow:false,
  102. categoryColumns: [],
  103. showType:'1',
  104. }
  105. },
  106. components: {
  107. },
  108. onLoad(e) {
  109. let data = uni.getStorageSync('checkSupplierData')
  110. this.form.supplierName = data.businessName
  111. this.form.supplierId = data.id
  112. console.log('this.form',this.form);
  113. },
  114. onReady() {
  115. //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
  116. this.$refs.uForm?.setRules(this.rules)
  117. },
  118. methods: {
  119. async submit(type){
  120. this.$refs.uForm.validate().then(async res1 => {
  121. console.log(res1);
  122. let res = await declareSupplier(this.form)
  123. if (res.data.code == 200) {
  124. uni.navigateTo({
  125. url: '/supplierPages/pages/supplier/supplierSuccess'
  126. });
  127. }
  128. }).catch(errors => {
  129. // uni.$u.toast('校验失败')
  130. })
  131. },
  132. }
  133. }
  134. </script>
  135. <style lang="less" scoped>
  136. .formbg{
  137. width: 750rpx;
  138. height: 100vh;
  139. border-radius: 0rpx 0rpx 0rpx 0rpx;
  140. display: flex;
  141. flex-direction: column;
  142. align-items: center;
  143. background: #f6f6f6;
  144. position: fixed;
  145. top: 0;
  146. z-index: 100;
  147. }
  148. .scrollview{
  149. width: 100vw;
  150. height: calc(100vh - 120rpx);
  151. }
  152. .formItemTitle{
  153. margin: 20rpx 0 20rpx 30rpx;
  154. }
  155. .u-form-item{
  156. background-color: #fff;
  157. }
  158. /deep/.u-form-item__body__left__content{
  159. padding-left: 30rpx;
  160. }
  161. /deep/.u-form-item__body__right{
  162. padding-right: 30rpx;
  163. }
  164. /deep/.u-form-item__body{
  165. padding: 30rpx 0;
  166. }
  167. .selectInput{
  168. display: flex;
  169. flex-direction: row;
  170. align-items: center;
  171. }
  172. .formItem {
  173. background: #fff;
  174. }
  175. .btn2{
  176. width: 650rpx;
  177. height: 80rpx;
  178. background: #46A6FF;
  179. border-radius: 64rpx 64rpx 64rpx 64rpx;
  180. opacity: 1;
  181. font-size: 28rpx;
  182. font-weight: 500;
  183. color: #FFFFFF;
  184. line-height: 80rpx;
  185. text-align: center;
  186. margin-left: 10rpx;
  187. }
  188. .margin20{
  189. margin-top: 20rpx;
  190. }
  191. .btnflex{
  192. padding: 24rpx;
  193. }
  194. </style>