PulishDemand.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <div class="pulishDemand">
  3. <AccountCenterTop/>
  4. <div class="pulishDemandMain">
  5. <divTitle h_title="发布供需"/>
  6. <el-form :model="demandData"
  7. :rules="rules"
  8. ref="demandFormRefs"
  9. hide-required-asterisk
  10. label-width="180px"
  11. label-position="right">
  12. <el-form-item label="需求分类" prop="ftype" >
  13. <el-select v-model="demandData.ftype" placeholder="请选择" @focus="openClass">
  14. <el-option
  15. v-for="item in supplyClass"
  16. :key="item.ttypedetailid"
  17. :label="item.ftype"
  18. :value="item.ftype">
  19. </el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item label="需求标题" prop="ftitle">
  23. <el-input v-model="demandData.ftitle" placeholder="请填写消息标题"></el-input>
  24. </el-form-item>
  25. <el-form-item label="需求内容" prop="fcontent">
  26. <el-input type="textarea" v-model="demandData.fcontent" placeholder="请填写需求内容"></el-input>
  27. </el-form-item>
  28. <el-form-item label="图片">
  29. </el-form-item>
  30. <el-form-item label="下架日期">
  31. <el-date-picker
  32. type="date"
  33. v-model="demandData.fenddate"
  34. placeholder="请选择下架日期"
  35. format="yyyy 年 MM 月 dd 日"
  36. value-format="yyyy-MM-dd"
  37. class="input-class"
  38. >
  39. </el-date-picker>
  40. </el-form-item>
  41. </el-form>
  42. <div class="operate">
  43. <el-button class="operate_reset " @click="resetMsg">重置</el-button>
  44. <el-button class="operate_update themeButton" @click="updateMsg">保存</el-button>
  45. </div>
  46. </div>
  47. <SystemLoginCopyBottom bgc_blue="background: #4DC2D4"/>
  48. </div>
  49. </template>
  50. <script type='text/javascript'>
  51. import AccountCenterTop from "../../../commonCmp/AccountCenter/AccountCenterTop.vue"
  52. import SystemLoginCopyBottom from "../../../commonCmp/WesiteInherentInfo/SystemLoginCopyBottom.vue"
  53. import divTitle from "../../../commonCmp/AccountCenter/divTitle.vue"
  54. export default {
  55. name: "PulishDemand",
  56. components: {
  57. AccountCenterTop,
  58. SystemLoginCopyBottom,
  59. divTitle
  60. },
  61. data() {
  62. return {
  63. demandData: {
  64. ftype: "",
  65. ftitle: "",
  66. fcontent: "",
  67. fenddata: "",
  68. fissupply: 0
  69. },
  70. rules: {
  71. ftype: [{ required: true, message: "分类不能为空", trigger: "blur"}],
  72. ftitle: [{ required: true, message: "标题不能为空", trigger: "blur"}],
  73. fcontent: [{required: true, message: "内容不能为空", trigger: "blur"}]
  74. },
  75. supplyClass: [],
  76. }
  77. },
  78. methods: {
  79. resetMsg() {
  80. this.demandData = {
  81. ftype: "",
  82. ftitle: "",
  83. fcontent: "",
  84. fenddata: "",
  85. fissupply: 0
  86. }
  87. },
  88. updateMsg() {
  89. // 表单验证
  90. this.$refs.demandFormRefs.validate( async valid => {
  91. if (!valid) return;
  92. const res = await this.$http.post("", this.getFullItfUpdateSupply())
  93. if (res.status >= 300 && res.status < 200) return;
  94. const res1 = await this.$http.post("", this.getFullItfPulishSupply(res.data.data[0].tsupplyanddemandid));
  95. if (res1.status >= 300 && res1.status < 200) return;
  96. this.$router.back();
  97. })
  98. },
  99. // 提交修改信息
  100. async openClass() {
  101. const res = await this.$http.post("", this.getFullItfSupplyClass())
  102. if (res.status >= 300 && res.status < 200) return;
  103. this.supplyClass = res.data.data;
  104. },
  105. // 发送获取分类请求体
  106. getFullItfSupplyClass() {
  107. this.$store.commit("getTokenInterfaceBaseType", {
  108. classname: 'enterprise.system.supplyanddemand',
  109. method: 'query_typeselectList'
  110. })
  111. const interfaceType = this.$store.state.interfaceData;
  112. interfaceType.content = {};
  113. return interfaceType;
  114. },
  115. // 新增修改供需信息
  116. getFullItfUpdateSupply() {
  117. this.$store.commit("getTokenInterfaceBaseType", {
  118. classname: 'customer.supplyanddemand.supplyanddemand',
  119. method: 'insertormodify'
  120. })
  121. const interfaceType = this.$store.state.interfaceData;
  122. interfaceType.content = this.demandData;
  123. return interfaceType;
  124. },
  125. // 发布供需信息请求体
  126. getFullItfPulishSupply(tsupplyanddemandid) {
  127. this.$store.commit("getTokenInterfaceBaseType", {
  128. classname: 'customer.supplyanddemand.supplyanddemand',
  129. method: 'updatesupplyanddemandstatus'
  130. })
  131. const interfaceType = this.$store.state.interfaceData;
  132. interfaceType.content = {
  133. tsupplyanddemandid,
  134. fstatus: "发布"
  135. }
  136. return interfaceType;
  137. }
  138. }
  139. }
  140. </script>
  141. <style lang='scss' scoped>
  142. /deep/ .el-select-dropdown {
  143. position: absolute;
  144. top: 28rem;
  145. left: 36.1rem;
  146. }
  147. .pulishDemand {
  148. position: relative;
  149. .el-select {
  150. /deep/ .el-input__inner {
  151. font-size: 1.8rem;
  152. }
  153. }
  154. // label样式
  155. /deep/ .el-form-item__label {
  156. position: relative;
  157. font-size: 1.8rem;
  158. color: #000000;
  159. opacity: 50%;
  160. }
  161. // 输入框背景
  162. /deep/ .el-input__inner {
  163. width: 27.5rem;
  164. height: 4.5rem;
  165. margin-left: .9rem;
  166. background: #F4F4F4;
  167. }
  168. // 提示小绿星
  169. /deep/ .el-form-item__label::after {
  170. position: absolute;
  171. content: "*";
  172. top: -16%;
  173. color: #4BBECF;
  174. }
  175. /*textarea深度改变*/
  176. /deep/ .el-textarea__inner {
  177. width: 126.2rem;
  178. height: 27.2rem;
  179. font-size: 1.8rem;
  180. padding-top: 1.4rem;
  181. background: #F4F4F4;
  182. margin-left: .9rem;
  183. resize: none
  184. }
  185. // 输入框提示错误位置
  186. /deep/.el-form-item__error {
  187. top: 100%;
  188. left: 1%;
  189. }
  190. .pulishDemandMain {
  191. margin-top: 2.5rem;
  192. position: relative;
  193. left: 50%;
  194. width: 156.8rem;
  195. height: 100.7rem;
  196. transform: translate(-50%);
  197. background-color: #FFF;
  198. .el-form {
  199. margin-top: 6rem;
  200. .el-form-item {
  201. margin-bottom: 2.5rem;
  202. .el-input {
  203. font-size: 1.8rem;
  204. }
  205. }
  206. }
  207. .operate {
  208. position: absolute;
  209. bottom: 20%;
  210. left: 50%;
  211. transform: translate(-50%);
  212. .operate_reset, .operate_update {
  213. width: 23.6rem;
  214. height: 5.2rem;
  215. font-size: 2.4rem;
  216. color: #fff;
  217. border-radius: 1rem;
  218. }
  219. .operate_reset {
  220. color:#4CBECF;
  221. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
  222. border: 2px solid #4CBECF;
  223. }
  224. }
  225. }
  226. }
  227. </style>