suppAdd.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <div class="app-content">
  3. <form @submit="formSubmit">
  4. <div class="module-com input-line-wrap">
  5. <tui-list-cell class="line-cell" :hover="false">
  6. <div class="tui-title required">名称</div>
  7. <input v-model="form.name" class="tui-input" placeholder="请填写名称" maxlength="50" type="text" name="username" @input="searchGhs" />
  8. </tui-list-cell>
  9. <tui-list-cell class="line-cell" :hover="false">
  10. <view class="tui-title required">所在地</view>
  11. <radio-group class="tui-input" @change="locationChange">
  12. <label class="list" for="jdLink">
  13. <radio id="jdLink" value="0" :checked="form.location == 0" style="transform:scale(0.7,0.7)" />
  14. <span class="checkbox-text">上游</span>
  15. </label>
  16. <label class="list" for="localLink">
  17. <radio id="localLink" value="1" :checked="form.location == 1" style="transform:scale(0.7,0.7)" />
  18. <span class="checkbox-text">本地</span>
  19. </label>
  20. </radio-group>
  21. </tui-list-cell>
  22. <view style="margin-top:20upx;padding:0 30upx 0 30upx;">选本地,录采购单,没有打包费、运费填写入口。</view>
  23. <view style="margin-top:50upx;padding-left:50upx;font-size:38upx;margin-bottom:90upx;" v-if="!$util.isEmpty(supplierList)">
  24. <view v-for="(item, index) in supplierList" :key="index" @click="goToCg(item)" style="margin-bottom:30upx;">{{ item.name }}</view>
  25. </view>
  26. </div>
  27. <view class="app-footer">
  28. <button class="admin-button-com big default" @click="goBack()">取消</button>
  29. <button class="admin-button-com big blue" formType="submit">确认</button>
  30. </view>
  31. </form>
  32. </div>
  33. </template>
  34. <script>
  35. import TuiListCell from "@/components/plugin/list-cell";
  36. import { ghsAdd,getList } from "@/api/ghs"
  37. const form = require("@/utils/formValidation.js");
  38. import ModalModule from "@/components/plugin/modal";
  39. export default {
  40. components: {
  41. TuiListCell,ModalModule
  42. },
  43. data() {
  44. return {
  45. form: {
  46. name: '',
  47. location:0,
  48. mobile:''
  49. },
  50. supplierList:[]
  51. }
  52. },
  53. methods: {
  54. goToCg(item){
  55. this.pageTo({url: '/pagesPurchase/add?ghsId='+item.id+'&ghsName='+item.name+'&location='+item.location,type:2})
  56. },
  57. searchGhs(e){
  58. let that = this
  59. let name = e.target.value ? e.target.value : ''
  60. this.showGhsModel = true
  61. getList({ pageSize:20, name:name }).then(res => {
  62. that.supplierList = res.data.list ? res.data.list : []
  63. })
  64. },
  65. locationChange(e){
  66. this.form.location = e.detail.value
  67. },
  68. init(){
  69. if(this.option.location){
  70. this.form.location = this.option.location
  71. }
  72. },
  73. formSubmit(e) {
  74. let rules = [
  75. {
  76. name: "username",
  77. rule: ["required"],
  78. msg: ["请填写名称"]
  79. }
  80. ];
  81. let formData = e.detail.value;
  82. let checkRes = form.validation(formData, rules);
  83. if (!checkRes) {
  84. this.confirmFn();
  85. } else {
  86. this.$msg(checkRes);
  87. }
  88. },
  89. confirmFn() {
  90. uni.showLoading({mask:true})
  91. ghsAdd(this.form).then(res => {
  92. uni.setStorageSync('newGhs', res.data)
  93. uni.hideLoading()
  94. setTimeout(() => {
  95. this.$util.pageTo(1)
  96. }, 1000)
  97. })
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss" scoped>
  103. .app-content {
  104. min-height: calc(100vh - 20upx);
  105. padding-top: 20upx;
  106. }
  107. .prompt-text {
  108. color: $fontColor3;
  109. padding-left: 30upx;
  110. margin-bottom: 30upx;
  111. }
  112. .module-com {
  113. margin-bottom: 20upx;
  114. .member-wrap {
  115. .member-det {
  116. font-size: 24upx;
  117. margin-left: 20upx;
  118. }
  119. }
  120. .remark-wrap {
  121. align-items: flex-start;
  122. .remark {
  123. height: 240upx;
  124. }
  125. }
  126. }
  127. // 按钮
  128. .confirm-btn {
  129. width: calc(100% - 60upx);
  130. margin: 60upx 30upx 20upx;
  131. .admin-button-com {
  132. width: 100%;
  133. }
  134. }
  135. .select-cmd_bx {
  136. .num_bx {
  137. margin-top:30upx;
  138. margin-bottom:50upx;
  139. margin-left:80upx;
  140. view{
  141. height: 80upx;
  142. font-size: 28upx;
  143. }
  144. input {
  145. height: 70upx;
  146. border: 1upx solid #dddddd;
  147. border-radius: 4upx;
  148. text-align: left;
  149. margin-right: 24upx;
  150. font-size: 35upx;
  151. width:300upx;
  152. }
  153. }
  154. }
  155. .app-footer {
  156. justify-content: space-evenly;
  157. z-index: 9999;
  158. .admin-button-com {
  159. width: 46%;
  160. }
  161. }
  162. </style>