sellGrain.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844
  1. <template>
  2. <view class="center">
  3. <view class="buyup">
  4. <view class="c-row b-b">
  5. <text class="tit">名头</text>
  6. <view class="con-list">
  7. <text @click="navToDetailPage">{{deptList.seller}}<text class='tip_text cuIcon-right'></text></text>
  8. </view>
  9. </view>
  10. <view class="c-row b-b">
  11. <text class="tit">标题</text>
  12. <view class="con-list">
  13. <input maxlength='16' minlength='2' placeholder="请输入标题,不超过16个字" name="input"
  14. v-model="deptList.title"></input>
  15. </view>
  16. </view>
  17. <view class="c-row b-b">
  18. <text class="tit">货名</text>
  19. <view class="con-list">
  20. <input placeholder="请输入货名,如玉米" name="input" v-model="deptList.goodsName"></input>
  21. </view>
  22. </view>
  23. <view class="c-row b-b">
  24. <text class="tit">出售量(吨)</text>
  25. <view class="con-list">
  26. <input placeholder="请输入出售重量,如1000" name="input" v-model="deptList.plannedSaleVolume"></input>
  27. </view>
  28. </view>
  29. <view class="c-row b-b">
  30. <text class="tit">最小成交量(吨)</text>
  31. <view class="con-list">
  32. <input placeholder="请输入最小成交量" name="input" v-model="deptList.minimumVolume"></input>
  33. </view>
  34. </view>
  35. <view class="c-row b-b">
  36. <text class="tit">类型</text>
  37. <picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
  38. <view class="picker" v-model="deptList.salePlanType">
  39. {{typesIndex>-1?typesType[typesIndex]:'请选择类型'}}
  40. </view>
  41. </picker>
  42. </view>
  43. <view class="c-row b-b">
  44. <text class="tit">价格类型</text>
  45. <view class="con-list">
  46. <!-- <input placeholder="请填写价格类型" name="input" v-model="deptList.priceType"></input> -->
  47. {{deptList.priceType}}
  48. </view>
  49. </view>
  50. <view class="c-row b-b" v-if="this.typesIndex == 0">
  51. <text class="tit">单价(元/吨)</text>
  52. <view class="con-list">
  53. <input placeholder="请填写单价" name="input" v-model="deptList.salePrice"></input>
  54. </view>
  55. </view>
  56. <view class="c-row b-b" v-if="this.typesIndex == 1">
  57. <text class="tit">基差(元/吨)</text>
  58. <view class="con-list">
  59. <input placeholder="请输入基差" name="input" v-model="deptList.basisPrice"></input>
  60. </view>
  61. </view>
  62. <view class="c-row b-b">
  63. <text class="tit">产地</text>
  64. <view class="con-list">
  65. <view @click='regionchange1'>{{region1}}</view>
  66. <u-picker :params='params1' @confirm='regionpicker1' mode="region" v-model="show1"></u-picker>
  67. </view>
  68. </view>
  69. <view class="c-row b-b">
  70. <text class="tit">发货地区</text>
  71. <view class="con-list">
  72. <view @click='regionchange'>{{region}}</view>
  73. <u-picker :params='params' @confirm='regionpicker' mode="region" v-model="show"></u-picker>
  74. </view>
  75. </view>
  76. <view class="c-row b-b">
  77. <text class="tit">卖方手机号</text>
  78. <view class="con-list">
  79. <input placeholder="请输入卖方手机号" @input='phoneinput' name="input" v-model="deptList.sellerPhone"></input>
  80. </view>
  81. </view>
  82. <view class="c-row b-b">
  83. <button :class='codestatus&&!sendDisabled?"active":""' @click='getcode'
  84. class='getcode'>{{sendText}}</button>
  85. <view class="con-list">
  86. <input v-model='verifyCode' placeholder="请输入验证码" type="text">
  87. </view>
  88. </view>
  89. </view>
  90. <view class="buylow">
  91. <view class="c-row ">
  92. <checkbox style='transform: scale(0.8);' value='1' :disabled="morestatus" :checked="checked" @click='checkedbox'></checkbox><text
  93. style="font-size: 14px; ">完善更多信息<text
  94. style="font-size: 10px; color: #AFB3BF;">(选填,可由客服人员代为完善)</text></text>
  95. </view>
  96. <view v-if='checked' class="c-row b-b">
  97. <text class="tit">水分(%)<= </text>
  98. <view class="con-list">
  99. <input @input='moreinput' placeholder="请填写水分占比" name="input" v-model="deptList.waterContent"></input>
  100. </view>
  101. </view>
  102. <view v-if='checked' class="c-row b-b">
  103. <text class="tit">容重(g/L)<= </text>
  104. <view class="con-list">
  105. <input @input='moreinput' placeholder="请填写容重" name="input" v-model="deptList.bulkDensity"></input>
  106. </view>
  107. </view>
  108. <view v-if='checked' class="c-row b-b">
  109. <text class="tit">热损伤(%)<= </text>
  110. <view class="con-list">
  111. <input @input='moreinput' placeholder="请填写热损伤占比" name="input" v-model="deptList.jiaorenli"></input>
  112. </view>
  113. </view>
  114. <view v-if='checked' class="c-row b-b">
  115. <text class="tit">杂质(%)<= </text>
  116. <view class="con-list">
  117. <input @input='moreinput' placeholder="请填写杂质占比" name="input" v-model="deptList.impurity"></input>
  118. </view>
  119. </view>
  120. <view v-if='checked' class="c-row b-b">
  121. <text class="tit">霉变粒(%)<= </text>
  122. <view class="con-list">
  123. <input @input='moreinput' placeholder="请填写霉变粒占比" name="input" v-model="deptList.mildewGrain"></input>
  124. </view>
  125. </view>
  126. <view v-if='checked' class="c-row b-b">
  127. <text class="tit">不完整粒(%)<= </text>
  128. <view class="con-list">
  129. <input @input='moreinput' placeholder="请填写不完整粒占比" name="input" v-model="deptList.imperfectGrain"></input>
  130. </view>
  131. </view>
  132. <view v-if='checked' class="c-row b-b">
  133. <text class="tit">蛋白(%)<= </text>
  134. <view class="con-list">
  135. <input @input='moreinput' placeholder="请填写蛋白占比" name="input" v-model="deptList.protein"></input>
  136. </view>
  137. </view>
  138. <view v-if='checked' class="c-row b-b">
  139. <text class="tit">粒型 </text>
  140. <picker @change="liChange" :value="liIndex" :range="liType" class="con-list" v-model="deptList.grain">
  141. <view class="con-list">
  142. {{liIndex>-1?liType[liIndex]:'请选择粒型'}}
  143. </view>
  144. </picker>
  145. </view>
  146. <view v-if='checked' class="c-row b-b">
  147. <text class="tit">品级 </text>
  148. <picker @change="pinChange" :value="pinIndex" :range="pinType" class="con-list">
  149. <view class="con-list">
  150. {{pinIndex>-1?pinType[pinIndex]:'请选择品级'}}
  151. </view>
  152. </picker>
  153. </view>
  154. <view v-if='checked' class="c-row b-b">
  155. <text class="tit">产出年份</text>
  156. <view class="con-list">
  157. <view @click='yearchange'>{{deptList.outputYear == null?"请选择出厂年份":deptList.outputYear}}</view>
  158. <u-picker :params='params2' @confirm='yearpicker($event)' v-model="show2" mode="time" :start-year="startData" :end-year="endData">
  159. </u-picker>
  160. </view>
  161. </view>
  162. <view v-if='checked' class="c-row b-b">
  163. <text class="tit">包装方式</text>
  164. <picker @change="baoChange" :value="baoIndex" :range="baoType" class="con-list">
  165. <view class="con-list">
  166. {{baoIndex>-1?baoType[baoIndex]:'请选择包装方式'}}
  167. </view>
  168. </picker>
  169. </view>
  170. <view v-if='checked&&baoIndex!=0' class="c-row b-b">
  171. <text class="tit">袋装备注</text>
  172. <view class="con-list">
  173. <input @input='moreinput' placeholder="请填写袋装备注" name="input" v-model="deptList.baggingNotes"></input>
  174. </view>
  175. </view>
  176. <view v-if='checked' class="c-row ">
  177. <text class="tit">运费承担方</text>
  178. <picker @change="chengChange" :value="chengIndex" :range="chengType" class="con-list">
  179. <view class="con-list">
  180. {{chengIndex>-1?chengType[chengIndex]:'请选择运费承担方'}}
  181. </view>
  182. </picker>
  183. </view>
  184. </view>
  185. <button @click="commit()" class="btn">发布</button>
  186. </view>
  187. </template>
  188. <script>
  189. import {
  190. mapState
  191. } from 'vuex';
  192. export default {
  193. data() {
  194. return {
  195. types: '',
  196. goods: {},
  197. typesType: ["现货", "期货"],
  198. typesIndex: 0,
  199. deptList: {
  200. salePlanType: '现货',
  201. salePlanTypeKey: 0,
  202. grainKey: 0,
  203. gradeKey: 0,
  204. packingTypeKey: 0,
  205. freightPayerKey: -1,
  206. priceType: "定价销售",
  207. grain: "",
  208. grade: "一等品",
  209. packingType: "散装",
  210. freightPayer: "",
  211. },
  212. params: {
  213. province: true,
  214. city: true,
  215. area: true,
  216. },
  217. params1: {
  218. province: true,
  219. city: true,
  220. },
  221. checked: true,
  222. insertSalePlanInfo: {},
  223. liIndex: -1,
  224. liType: ['塔粮', '筛粮', '中粒', '大粒'],
  225. pinIndex: -1,
  226. pinType: ['一等品', '二等品', '三等品', '等外'],
  227. show: false,
  228. show1: false,
  229. show2:false,
  230. region: '请选择发货地区',
  231. regions: "",
  232. region1: '请选择产地',
  233. region2: "",
  234. baoIndex: -1,
  235. baoType: ['散装', '大袋', '小袋'],
  236. chengIndex: -1,
  237. chengType: ['可议', '买方承担', '卖方承担'],
  238. codestatus: false,
  239. sendDisabled: false,
  240. sendText: '获取验证码',
  241. verifyCode:"",
  242. verification:true,
  243. params2: {
  244. year: true,
  245. },
  246. morestatus:false
  247. }
  248. },
  249. computed: {
  250. ...mapState(['hasLogin', 'userInfo']),
  251. startData(){
  252. var data = new Date()
  253. return data.getFullYear() - 30
  254. },
  255. endData(){
  256. var data = new Date()
  257. return data.getFullYear()
  258. }
  259. },
  260. onLoad(options) {
  261. if (options.customerName) {
  262. this.deptList.seller = options.customerName
  263. }
  264. },
  265. onShow() {
  266. var that = this
  267. this.$api.doRequest('get', '/identityAuthenticationInfo/getInfo', {
  268. commonId: this.userInfo.id
  269. }).then(res => {
  270. if (res.data.code == 200) {
  271. if (res.data.data.customerTypeFlag == 1) {
  272. that.$set(this.deptList, 'seller', res.data.data.customerName)
  273. } else {
  274. that.$set(this.deptList, 'seller', res.data.data.compName)
  275. }
  276. this.goods = res.data.data
  277. }
  278. uni.hideLoading()
  279. })
  280. },
  281. methods: {
  282. yearchange() {
  283. this.show2 = true
  284. },
  285. moreinput(e){
  286. if(e.detail.value.length>0){
  287. this.morestatus=true
  288. }else{
  289. this.morestatus=false
  290. }
  291. },
  292. yearpicker(e) {
  293. if(e!=null){
  294. this.morestatus=true
  295. }else{
  296. this.morestatus=false
  297. }
  298. this.deptList.outputYear = e.year
  299. },
  300. // async amendprice() {
  301. // var that = this
  302. // this.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  303. // phone: this.deptList.buyerPhone,
  304. // verifyCode: this.verifyCode
  305. // }).then(res => {
  306. // if (res.data.code == 200) {
  307. // } else {
  308. // that.verification = false
  309. // uni.showToast({
  310. // title: res.data.message,
  311. // icon: 'none',
  312. // duration: 2000
  313. // })
  314. // return false
  315. // }
  316. // })
  317. // .catch(res => {
  318. // that.verification = false
  319. // uni.showToast({
  320. // title: res.data.message,
  321. // icon: 'none',
  322. // duration: 2000
  323. // })
  324. // return false
  325. // });
  326. // },
  327. phoneinput(e){
  328. if(e.detail.value.length==11){
  329. this.codestatus=true
  330. }
  331. },
  332. getcode() {
  333. var that = this
  334. if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(that.deptList.sellerPhone)) {
  335. this.$api.doRequest('get', '/commonUser/sendVerifyCode', {
  336. phone: that.deptList.sellerPhone
  337. }).then(res => {
  338. if (res.data.code == 200) {
  339. that.sendDisabled = true
  340. let sec = 60
  341. let interval = setInterval(() => {
  342. sec--;
  343. that.sendText = sec + 's后重发'
  344. if (sec <= 0) {
  345. that.sendDisabled = false
  346. that.sendText = "获取验证码"
  347. clearInterval(interval)
  348. }
  349. }, 1000)
  350. } else {
  351. uni.showToast({
  352. title: res.data.message,
  353. icon: 'none',
  354. duration: 2000
  355. })
  356. return
  357. }
  358. })
  359. .catch(res => {
  360. uni.showToast({
  361. title: res.data.message,
  362. icon: 'none',
  363. duration: 2000
  364. })
  365. return
  366. });
  367. } else {
  368. uni.showToast({
  369. title: '请输入正确的手机号',
  370. icon: 'none',
  371. duration: 2000
  372. })
  373. }
  374. },
  375. regionpicker(e) {
  376. this.deptList.sendPrivate = e.province.label
  377. this.deptList.sendCity = e.city.label
  378. this.deptList.sendArea = e.area.label
  379. this.region = e.province.label + '-' + e.city.label + '-' + e.area.label
  380. this.regions = e.province.label + '-' + e.city.label + '-' + e.area.label
  381. },
  382. regionchange() {
  383. this.show = true
  384. },
  385. regionpicker1(e) {
  386. this.deptList.outputPrivate = e.province.label
  387. this.deptList.outputCity = e.city.label
  388. this.region1 = e.province.label + '-' + e.city.label
  389. this.region2 = e.province.label + '-' + e.city.label
  390. },
  391. regionchange1() {
  392. this.show1 = true
  393. },
  394. checkedbox(e) {
  395. this.checked = !this.checked
  396. },
  397. typeChange(e) {
  398. this.typesIndex = e.detail.value
  399. this.types = this.typesType[this.typesIndex];
  400. this.deptList.salePlanTypeKey = e.detail.value
  401. this.deptList.salePlanType = this.typesType[this.typesIndex];
  402. if (this.typesIndex == 0) {
  403. this.deptList.priceType = '定价销售'
  404. } else {
  405. this.deptList.priceType = '期货盘面价+基差'
  406. }
  407. },
  408. navToDetailPage() {
  409. // if (index == 1) {
  410. uni.navigateTo({
  411. url: `/pageD/myRelease/Identity_switching?status=2`
  412. })
  413. },
  414. commit() {
  415. if (!this.deptList.title) {
  416. this.$api.msg('标题不能为空')
  417. return
  418. }
  419. if (this.deptList.title.length > 16 || this.deptList.title.length < 2) {
  420. this.$api.msg('标题输入错误')
  421. return
  422. }
  423. if (!this.deptList.goodsName) {
  424. this.$api.msg('货名不能为空')
  425. return
  426. }
  427. if (this.deptList.goodsName.length > 6 || this.deptList.goodsName.length < 1) {
  428. this.$api.msg('货名输入错误')
  429. return
  430. }
  431. if (!this.deptList.plannedSaleVolume) {
  432. this.$api.msg('出售量不能为空')
  433. return
  434. }
  435. if (this.deptList.plannedSaleVolume > 100000 || this.deptList.plannedSaleVolume < 1) {
  436. this.$api.msg('出售量输入错误')
  437. return
  438. }
  439. if (this.deptList.plannedSaleVolume.indexOf('.') != -1) {
  440. if (this.deptList.plannedSaleVolume.split('.')[1].length > 2) {
  441. this.$api.msg('出售量输入错误')
  442. return
  443. }
  444. }
  445. if (!this.deptList.minimumVolume) {
  446. this.$api.msg('最小成交量不能为空')
  447. return
  448. }
  449. if (this.deptList.minimumVolume > 100000 || this.deptList.minimumVolume < 1) {
  450. this.$api.msg('最小成交量输入错误')
  451. return
  452. }
  453. if (this.deptList.minimumVolume.indexOf('.') != -1) {
  454. if (this.deptList.minimumVolume.split('.')[1].length > 2) {
  455. this.$api.msg('最小成交量输入错误')
  456. return
  457. }
  458. }
  459. if (!this.deptList.salePlanType) {
  460. this.$api.msg('类型不能为空')
  461. return
  462. }
  463. if (!this.deptList.priceType) {
  464. this.$api.msg('价格类型不能为空')
  465. return
  466. }
  467. if (this.deptList.salePlanType == '现货') {
  468. if (!this.deptList.salePrice) {
  469. this.$api.msg('单价不能为空')
  470. return
  471. }
  472. if (this.deptList.salePrice > 100000 || this.deptList.salePrice < 1) {
  473. this.$api.msg('单价输入错误')
  474. return
  475. }
  476. if (this.deptList.salePrice.indexOf('.') != -1) {
  477. if (this.deptList.salePrice.split('.')[1].length > 2) {
  478. this.$api.msg('单价输入错误')
  479. return
  480. }
  481. }
  482. } else if (this.deptList.salePlanType == '期货') {
  483. if (!this.deptList.basisPrice) {
  484. this.$api.msg('基差(元/吨)不能为空')
  485. return
  486. }
  487. if (this.deptList.basisPrice > 10000 || this.deptList.basisPrice < 1) {
  488. this.$api.msg('基差输入错误')
  489. return
  490. }
  491. if (this.deptList.basisPrice.indexOf('.') != -1) {
  492. if (this.deptList.basisPrice.split('.')[1].length > 2) {
  493. this.$api.msg('基差输入错误')
  494. return
  495. }
  496. }
  497. }
  498. if (!this.regions) {
  499. this.$api.msg('发货地区不能为空')
  500. return
  501. }
  502. if (!this.region2) {
  503. this.$api.msg('产地不能为空')
  504. return
  505. }
  506. if (!this.deptList.sellerPhone) {
  507. this.$api.msg('卖方手机号不能为空')
  508. return
  509. }
  510. if (this.deptList.sellerPhone.length != 11) {
  511. this.$api.msg('卖方手机号输入错误')
  512. return
  513. }
  514. if (!this.verifyCode) {
  515. this.$api.msg('验证码不能为空')
  516. return
  517. }
  518. if (this.checked == false) {
  519. if (this.deptList.waterContent && this.deptList.waterContent < 1 ||
  520. this.deptList.waterContent && this.deptList.waterContent > 40) {
  521. this.$api.msg('水分输入错误')
  522. return
  523. }
  524. if (this.deptList.waterContent && this.deptList.waterContent.indexOf('.') != -1) {
  525. if (this.deptList.waterContent.split('.')[1].length > 2) {
  526. this.$api.msg('水分输入错误')
  527. return
  528. }
  529. }
  530. if (this.deptList.bulkDensity && this.deptList.bulkDensity < 500 ||
  531. this.deptList.bulkDensity && this.deptList.bulkDensity > 1000) {
  532. this.$api.msg('容重输入错误')
  533. return
  534. }
  535. if (this.deptList.jiaorenli && this.deptList.jiaorenli < 1 ||
  536. this.deptList.jiaorenli && this.deptList.jiaorenli > 40) {
  537. this.$api.msg('热损伤输入错误')
  538. return
  539. }
  540. if (this.deptList.jiaorenli && this.deptList.jiaorenli.indexOf('.') != -1) {
  541. if (this.deptList.jiaorenli.split('.')[1].length > 2) {
  542. this.$api.msg('热损伤输入错误')
  543. return
  544. }
  545. }
  546. if (this.deptList.impurity && this.deptList.impurity < 1 ||
  547. this.deptList.impurity && this.deptList.impurity > 40) {
  548. this.$api.msg('杂质输入错误')
  549. return
  550. }
  551. if (this.deptList.impurity && this.deptList.impurity.indexOf('.') != -1) {
  552. if (this.deptList.impurity.split('.')[1].length > 2) {
  553. this.$api.msg('杂质输入错误')
  554. return
  555. }
  556. }
  557. if (this.deptList.mildewGrain && this.deptList.mildewGrain < 1 ||
  558. this.deptList.mildewGrain && this.deptList.mildewGrain > 40) {
  559. this.$api.msg('霉变粒输入错误')
  560. return
  561. }
  562. if (this.deptList.mildewGrain && this.deptList.mildewGrain.indexOf('.') != -1) {
  563. if (this.deptList.mildewGrain.split('.')[1].length > 2) {
  564. this.$api.msg('霉变粒输入错误')
  565. return
  566. }
  567. }
  568. if (this.deptList.imperfectGrain && this.deptList.imperfectGrain < 1 ||
  569. this.deptList.imperfectGrain && this.deptList.imperfectGrain > 40) {
  570. this.$api.msg('不完整粒输入错误')
  571. return
  572. }
  573. if (this.deptList.imperfectGrain && this.deptList.imperfectGrain.indexOf('.') != -1) {
  574. if (this.deptList.imperfectGrain.split('.')[1].length > 2) {
  575. this.$api.msg('不完整粒输入错误')
  576. return
  577. }
  578. }
  579. if (this.deptList.protein && this.deptList.protein < 1 ||
  580. this.deptList.protein && this.deptList.protein > 80) {
  581. this.$api.msg('蛋白输入错误')
  582. return
  583. }
  584. if (this.deptList.protein && this.deptList.protein.indexOf('.') != -1) {
  585. if (this.deptList.protein.split('.')[1].length > 2) {
  586. this.$api.msg('蛋白输入错误')
  587. return
  588. }
  589. }
  590. }
  591. // if(this.amendprice() == false){
  592. // this.$api.msg('验证码输入有误!')
  593. // return
  594. // }
  595. var that = this
  596. this.insertSalePlanInfo = this.deptList
  597. this.insertSalePlanInfo.basisPrice = this.insertSalePlanInfo.basisPrice
  598. this.insertSalePlanInfo.commonId = this.userInfo.id
  599. this.insertSalePlanInfo.salePlanNo = 'XSJH' + this.getdate() + this.verifyinit()
  600. this.insertSalePlanInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  601. uni.showModal({
  602. title: '提示',
  603.     content: '确定发布交易信息?',
  604.     success: function (res) {
  605. if (res.confirm) {
  606. that.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  607. phone: that.deptList.sellerPhone,
  608. verifyCode: that.verifyCode
  609. }).then(res => {
  610. if (res.data.code == 200) {
  611. that.$api.doRequest('post', '/salePlanInfo/api/insertSalePlanInfo', that
  612. .insertSalePlanInfo).then(res => {
  613. if (res.data.code == 200) {
  614. that.$api.msg('发布成功')
  615. that.deptList = {}
  616. uni.navigateTo({
  617. url: `/pages/release/release`
  618. })
  619. } else {
  620. uni.showToast({
  621. title: res.data.message,
  622. icon: 'none',
  623. duration: 2000
  624. })
  625. }
  626. })
  627. .catch(res => {
  628. if(res.errmsg){
  629. uni.showToast({
  630. title: res.errmsg,
  631. icon: 'none',
  632. duration: 2000
  633. })
  634. }
  635. else{
  636. uni.showToast({
  637. title: "系统异常,请联系管理员",
  638. icon: 'none',
  639. duration: 2000
  640. })
  641. }
  642. });
  643. } else if (res.data.code == '11003') {
  644. uni.showModal({
  645. title: '提示',
  646. content: '验证码不正确',
  647. });
  648. } else {
  649. uni.showToast({
  650. title: res.data.message,
  651. icon: 'none',
  652. duration: 2000
  653. })
  654. return
  655. }
  656. })
  657. .catch(res => {
  658. uni.showToast({
  659. title: res.data.message,
  660. icon: 'none',
  661. duration: 2000
  662. })
  663. return
  664. });
  665. } else if (res.cancel) {
  666. }
  667. }});
  668. // this.insertProcurementPlanInfo = this.deptList
  669. // this.insertProcurementPlanInfo.basisPrice = -this.insertProcurementPlanInfo.basisPrice
  670. // this.insertProcurementPlanInfo.commonId = this.userInfo.id
  671. // this.insertProcurementPlanInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  672. },
  673. liChange(e) {
  674. if(e.detail.value!=-1){
  675. this.morestatus=true
  676. }else{
  677. this.morestatus=false
  678. }
  679. this.liIndex = e.detail.value
  680. this.litypes = this.liType[this.liIndex];
  681. this.deptList.grainKey = e.detail.value
  682. this.deptList.grain = this.liType[this.liIndex]
  683. },
  684. pinChange(e) {
  685. if(e.detail.value!=-1){
  686. this.morestatus=true
  687. }else{
  688. this.morestatus=false
  689. }
  690. this.pinIndex = e.detail.value
  691. this.pintypes = this.pinType[this.pinIndex];
  692. this.deptList.gradeKey = e.detail.value
  693. this.deptList.grade = this.pinType[this.pinIndex]
  694. },
  695. baoChange(e) {
  696. if(e.detail.value!=-1){
  697. this.morestatus=true
  698. }else{
  699. this.morestatus=false
  700. }
  701. this.baoIndex = e.detail.value
  702. this.baotypes = this.baoType[this.baoIndex];
  703. this.deptList.packingTypeKey = e.detail.value
  704. this.deptList.packingType = this.baoType[this.baoIndex];
  705. },
  706. getdate() {
  707. var date = new Date()
  708. var year = date.getFullYear() //获取完整的年份(4位)
  709. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  710. var datetime = date.getDate() //获取当前日(1-31)
  711. if (mouth < 10) {
  712. mouth = '0' + mouth
  713. }
  714. if (datetime < 10) {
  715. datetime = '0' + datetime
  716. }
  717. return year + mouth + datetime
  718. },
  719. verifyinit() {
  720. var arr = []
  721. for (var i = 48; i < 123; i++) {
  722. if (i > 57 && i < 65) continue
  723. if (i > 90 && i < 97) continue
  724. arr.push(String.fromCharCode(i))
  725. }
  726. arr.sort(function() {
  727. return Math.random() - 0.5
  728. })
  729. arr.length = 4
  730. return arr.join('')
  731. },
  732. chengChange(e) {
  733. if(e.detail.value!=-1){
  734. this.morestatus=true
  735. }else{
  736. this.morestatus=false
  737. }
  738. this.chengIndex = e.detail.value
  739. this.chengtypes = this.chengType[this.chengIndex];
  740. this.deptList.freightPayerKey = e.detail.value + 1
  741. this.deptList.freightPayer = this.chengType[this.chengIndex];
  742. }
  743. }
  744. }
  745. </script>
  746. <style>
  747. .center {
  748. padding: 10px 20px;
  749. background-color: #F5F6FA;
  750. }
  751. .c-row {
  752. display: -webkit-box;
  753. display: -webkit-flex;
  754. display: flex;
  755. -webkit-box-align: center;
  756. -webkit-align-items: center;
  757. align-items: center;
  758. padding: 20rpx 30rpx;
  759. position: relative;
  760. font-size:14px;
  761. }
  762. .con-list {
  763. -webkit-box-flex: 1;
  764. -webkit-flex: 1;
  765. flex: 1;
  766. display: -webkit-box;
  767. display: -webkit-flex;
  768. display: flex;
  769. -webkit-box-orient: vertical;
  770. -webkit-box-direction: normal;
  771. -webkit-flex-direction: column;
  772. flex-direction: column;
  773. line-height: 40rpx;
  774. text-align: right;
  775. padding-right: 20rpx;
  776. }
  777. .con-list input{
  778. font-size:14px !important;
  779. }
  780. .buyup {
  781. background-color: #FFFFFF;
  782. border-radius: 20px;
  783. margin-top: 10px;
  784. }
  785. .buylow {
  786. background-color: #FFFFFF;
  787. border-radius: 20px;
  788. margin-top: 10px;
  789. }
  790. .btn {
  791. border-radius: 20px;
  792. margin-top: 10px;
  793. background-color: #22C572;
  794. color: #FFFFFF;
  795. }
  796. .validate {
  797. width: 100px;
  798. height: 32px;
  799. background-color: #F5F6F9;
  800. color: #AFB3BF;
  801. border-radius: 10px;
  802. border: none;
  803. text-align: center;
  804. line-height: 30px;
  805. }
  806. .getcode {
  807. font-size: 14px;
  808. color: #AFB3BF;
  809. background: #F5F6F9;
  810. height: 30px;
  811. line-height: 30px;
  812. }
  813. .getcode.active {
  814. border: none;
  815. }
  816. .getcode.active {
  817. background: #22C572;
  818. color: #fff;
  819. }
  820. </style>