buyGrain.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  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.buyer}}<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.plannedPurchaseVolume"></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.procurementPlanType">
  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. {{deptList.priceType}}
  47. </view>
  48. </view>
  49. <view class="c-row b-b" v-if="this.typesIndex != 1">
  50. <text class="tit">单价(元/吨)</text>
  51. <view class="con-list">
  52. <input placeholder="请填写单价" name="input" v-model="deptList.procurementPrice"></input>
  53. </view>
  54. </view>
  55. <view class="c-row b-b" v-if="this.typesIndex == 1">
  56. <text class="tit">基差(元/吨)</text>
  57. <view class="con-list">
  58. <input placeholder="请输入基差" name="input" v-model="deptList.basisPrice"></input>
  59. </view>
  60. </view>
  61. <view class="c-row b-b">
  62. <text class="tit">收货地区</text>
  63. <view class="con-list">
  64. <view @click='regionchange'>{{region}}</view>
  65. <u-picker :params='params' @confirm='regionpicker' mode="region" v-model="show"></u-picker>
  66. </view>
  67. </view>
  68. <view class="c-row b-b">
  69. <text class="tit">买方手机号</text>
  70. <view class="con-list">
  71. <input placeholder="请输入买方手机号" name="input" v-model="deptList.buyerPhone"></input>
  72. </view>
  73. </view>
  74. <!-- <view class="c-row ">
  75. <text class="validate">获取验证码</text>
  76. <view class="con-list">
  77. <input placeholder="请填写6位短信验证码" name="input" v-model="deptList.title1"></input>
  78. </view>
  79. </view> -->
  80. <view style='width:100%;border-bottom:1px solid #E8E9ED;position:relative;padding:10px;' class="flex">
  81. <button :class='codestatus&&!sendDisabled?"active":""' @click='getcode'
  82. class='getcode'>{{sendText}}</button>
  83. <view style='width:70%;position:relative;margin-left: 200px;'>
  84. <view class="con-list">
  85. <input v-model='verifyCode' placeholder="请输入验证码" type="text">
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. <view class="buylow">
  91. <view class="c-row ">
  92. <checkbox style='transform: scale(0.8);' :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 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 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 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 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 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 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 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='regionchange1'>{{region1}}</view>
  158. <u-picker :params='params1' @confirm='regionpicker1' mode="region" v-model="show1"></u-picker>
  159. </view>
  160. </view>
  161. <view v-if='checked' class="c-row b-b">
  162. <text class="tit">产出年份</text>
  163. <picker @change="nianChange" :value="nianIndex" :range="nianType" class="con-list">
  164. <view class="con-list">
  165. {{nianIndex>-1?nianType[nianIndex]:'请选择产出年份'}}
  166. </view>
  167. </picker>
  168. </view>
  169. <view v-if='checked' class="c-row b-b">
  170. <text class="tit">包装方式</text>
  171. <picker @change="baoChange" :value="baoIndex" :range="baoType" class="con-list">
  172. <view class="con-list">
  173. {{baoIndex>-1?baoType[baoIndex]:'请选择包装方式'}}
  174. </view>
  175. </picker>
  176. </view>
  177. <view v-if='checked&&baoIndex!=0' class="c-row b-b">
  178. <text class="tit">袋装备注</text>
  179. <view class="con-list">
  180. <input placeholder="请填写袋装备注" name="input" v-model="deptList.baggingNotes"></input>
  181. </view>
  182. </view>
  183. <view v-if='checked' class="c-row b-b">
  184. <text class="tit">运费承担方</text>
  185. <picker @change="chengChange" :value="chengIndex" :range="chengType" class="con-list">
  186. <view class="con-list">
  187. {{chengIndex>-1?chengType[chengIndex]:'请选择运费承担方'}}
  188. </view>
  189. </picker>
  190. </view>
  191. </view>
  192. <button @click="commit()" class="btn">发布</button>
  193. </view>
  194. </template>
  195. <script>
  196. import {
  197. mapState
  198. } from 'vuex';
  199. export default {
  200. data() {
  201. return {
  202. types: '',
  203. goods: {},
  204. typesType: ["现货", "期货"],
  205. typesIndex: 0,
  206. deptList: {
  207. salePlanTypeKey: 0,
  208. grainKey: 0,
  209. gradeKey: 0,
  210. packingTypeKey: 0,
  211. freightPayerKey: 0,
  212. priceType: "定价采购",
  213. procurementPlanType: "现货",
  214. grain: "塔粮",
  215. grade: "不限(默认)",
  216. outputYear: "2020",
  217. packingType: "不限(默认)",
  218. freightPayer: "",
  219. },
  220. params: {
  221. province: true,
  222. city: true,
  223. area: true,
  224. },
  225. params1: {
  226. province: true,
  227. city: true,
  228. },
  229. checked: false,
  230. insertProcurementPlanInfo: {},
  231. liIndex: -1,
  232. liType: ['塔粮', '筛粮', '中粒', '大粒'],
  233. pinIndex: -1,
  234. pinType: ['一等品', '二等品', '三等品', '等外'],
  235. nianIndex: -1,
  236. nianType: ['2023', '2022', '2021', '2020', '2019', '2018', '2017', '2016', '2015', '2014', '2013', '2012',
  237. '2011'
  238. ],
  239. show: false,
  240. show1: false,
  241. region: '请选择收货地区',
  242. region1: '请选择产地',
  243. region2:"",
  244. baoIndex: -1,
  245. baoType: ['散装', '大袋', '小袋'],
  246. chengIndex: -1,
  247. chengType: ['可议', '买方承担', '卖方承担'],
  248. codestatus: false,
  249. sendDisabled: false,
  250. sendText: '获取验证码',
  251. verifyCode:"",
  252. verification:true,
  253. // DriverViewInfo:{},
  254. }
  255. },
  256. computed: {
  257. ...mapState(['hasLogin', 'userInfo'])
  258. },
  259. onLoad(options) {
  260. if (options.customerName) {
  261. this.deptList.buyer = options.customerName
  262. }
  263. },
  264. onShow() {
  265. var that = this
  266. this.$api.doRequest('get', '/identityAuthenticationInfo/getInfo', {
  267. commonId: that.userInfo.id
  268. }).then(res => {
  269. if (res.data.code == 200) {
  270. if (res.data.data.customerTypeFlag == 1) {
  271. that.$set(that.deptList, 'buyer', res.data.data.customerName)
  272. } else {
  273. that.$set(that.deptList, 'buyer', res.data.data.compName)
  274. }
  275. that.goods = res.data.data
  276. }
  277. uni.hideLoading()
  278. })
  279. },
  280. methods: {
  281. // async amendprice() {
  282. // var that = this
  283. // this.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  284. // phone: this.deptList.buyerPhone,
  285. // verifyCode: this.verifyCode
  286. // }).then(res => {
  287. // if (res.data.code == 200) {
  288. // } else {
  289. // that.verification = false
  290. // uni.showToast({
  291. // title: res.data.message,
  292. // icon: 'none',
  293. // duration: 2000
  294. // })
  295. // return false
  296. // }
  297. // })
  298. // .catch(res => {
  299. // that.verification = false
  300. // uni.showToast({
  301. // title: res.data.message,
  302. // icon: 'none',
  303. // duration: 2000
  304. // })
  305. // return false
  306. // });
  307. // },
  308. getcode() {
  309. var that = this
  310. if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(that.deptList.buyerPhone)) {
  311. this.$api.doRequest('get', '/commonUser/sendVerifyCode', {
  312. phone: that.deptList.buyerPhone
  313. }).then(res => {
  314. if (res.data.code == 200) {
  315. that.sendDisabled = true
  316. let sec = 60
  317. let interval = setInterval(() => {
  318. sec--;
  319. that.sendText = sec + 's后重发'
  320. if (sec <= 0) {
  321. that.sendDisabled = false
  322. that.sendText = "获取验证码"
  323. clearInterval(interval)
  324. }
  325. }, 1000)
  326. } else {
  327. uni.showToast({
  328. title: res.data.message,
  329. icon: 'none',
  330. duration: 2000
  331. })
  332. return
  333. }
  334. })
  335. .catch(res => {
  336. uni.showToast({
  337. title: res.data.message,
  338. icon: 'none',
  339. duration: 2000
  340. })
  341. return
  342. });
  343. } else {
  344. uni.showToast({
  345. title: '请输入正确的手机号',
  346. icon: 'none',
  347. duration: 2000
  348. })
  349. }
  350. },
  351. regionpicker(e) {
  352. this.deptList.receivePrivate = e.province.label
  353. this.deptList.receiveCity = e.city.label
  354. this.deptList.receiveArea = e.area.label
  355. this.region = e.province.label + '-' + e.city.label + '-' + e.area.label
  356. this.region2 = e.province.label + '-' + e.city.label + '-' + e.area.label
  357. },
  358. regionchange() {
  359. this.show = true
  360. },
  361. regionpicker1(e) {
  362. this.deptList.outputPrivate = e.province.label
  363. this.deptList.outputCity = e.city.label
  364. this.region1 = e.province.label + '-' + e.city.label
  365. },
  366. regionchange1() {
  367. this.show1 = true
  368. },
  369. checkedbox(e) {
  370. this.checked = !this.checked
  371. },
  372. typeChange(e) {
  373. this.typesIndex = e.detail.value
  374. this.types = this.typesType[this.typesIndex];
  375. this.deptList.procurementPlanTypeKey = e.detail.value + 1
  376. this.deptList.procurementPlanType = this.typesType[this.typesIndex];
  377. if (this.typesIndex == 0) {
  378. this.deptList.priceType = '定价采购'
  379. } else {
  380. this.deptList.priceType = '期货盘面价+基差'
  381. }
  382. },
  383. navToDetailPage() {
  384. uni.navigateTo({
  385. url: `/pageD/myRelease/Identity_switching`
  386. })
  387. },
  388. commit() {
  389. if (!this.deptList.title) {
  390. this.$api.msg('标题不能为空')
  391. return
  392. }
  393. if (this.deptList.title.length > 16 || this.deptList.title.length < 2) {
  394. this.$api.msg('标题输入错误')
  395. return
  396. }
  397. if (!this.deptList.goodsName) {
  398. this.$api.msg('货名不能为空')
  399. return
  400. }
  401. if (this.deptList.goodsName.length > 6 || this.deptList.goodsName.length < 1) {
  402. this.$api.msg('货名输入错误')
  403. return
  404. }
  405. if (!this.deptList.plannedPurchaseVolume) {
  406. this.$api.msg('采购量不能为空')
  407. return
  408. }
  409. if (this.deptList.plannedPurchaseVolume > 100000 || this.deptList.plannedPurchaseVolume < 1) {
  410. this.$api.msg('采购量输入错误')
  411. return
  412. }
  413. if (this.deptList.plannedPurchaseVolume.indexOf('.') != -1) {
  414. if (this.deptList.plannedPurchaseVolume.split('.')[1].length > 2) {
  415. this.$api.msg('采购量输入错误')
  416. return
  417. }
  418. }
  419. if (!this.deptList.minimumVolume) {
  420. this.$api.msg('最小成交量不能为空')
  421. return
  422. }
  423. if (this.deptList.minimumVolume > 100000 || this.deptList.minimumVolume < 1) {
  424. this.$api.msg('最小成交量输入错误')
  425. return
  426. }
  427. if (this.deptList.minimumVolume.indexOf('.') != -1) {
  428. if (this.deptList.minimumVolume.split('.')[1].length > 2) {
  429. this.$api.msg('最小成交量输入错误')
  430. return
  431. }
  432. }
  433. if (!this.deptList.procurementPlanType) {
  434. this.$api.msg('类型不能为空')
  435. return
  436. }
  437. if (!this.deptList.priceType) {
  438. this.$api.msg('价格类型不能为空')
  439. return
  440. }
  441. if (this.deptList.procurementPlanType == '现货') {
  442. if (!this.deptList.procurementPrice) {
  443. this.$api.msg('单价不能为空')
  444. return
  445. }
  446. if (this.deptList.procurementPrice > 100000 || this.deptList.procurementPrice < 1) {
  447. this.$api.msg('单价输入错误')
  448. return
  449. }
  450. if (this.deptList.procurementPrice.indexOf('.') != -1) {
  451. if (this.deptList.procurementPrice.split('.')[1].length > 2) {
  452. this.$api.msg('单价输入错误')
  453. return
  454. }
  455. }
  456. } else if (this.deptList.procurementPlanType == '期货') {
  457. if (!this.deptList.basisPrice) {
  458. this.$api.msg('基差(元/吨)不能为空')
  459. return
  460. }
  461. if (this.deptList.basisPrice > 10000 || this.deptList.basisPrice < 1) {
  462. this.$api.msg('基差输入错误')
  463. return
  464. }
  465. if (this.deptList.basisPrice.indexOf('.') != -1) {
  466. if (this.deptList.basisPrice.split('.')[1].length > 2) {
  467. this.$api.msg('基差输入错误')
  468. return
  469. }
  470. }
  471. }
  472. if (!this.region2) {
  473. this.$api.msg('收货地区不能为空')
  474. return
  475. }
  476. if (!this.deptList.buyerPhone) {
  477. this.$api.msg('买方手机号不能为空')
  478. return
  479. }
  480. if (this.deptList.buyerPhone.length!=11) {
  481. this.$api.msg('买方手机号输入错误')
  482. return
  483. }
  484. if(!this.verifyCode){
  485. this.$api.msg('验证码不能为空')
  486. return
  487. }
  488. if (this.checked == false) {
  489. if (this.deptList.waterContent && this.deptList.waterContent < 1 ||
  490. this.deptList.waterContent && this.deptList.waterContent > 40) {
  491. this.$api.msg('水分输入错误')
  492. return
  493. }
  494. if (this.deptList.waterContent && this.deptList.waterContent.indexOf('.') != -1) {
  495. if (this.deptList.waterContent.split('.')[1].length > 2) {
  496. this.$api.msg('水分输入错误')
  497. return
  498. }
  499. }
  500. if (this.deptList.bulkDensity && this.deptList.bulkDensity < 500 ||
  501. this.deptList.bulkDensity && this.deptList.bulkDensity > 1000) {
  502. this.$api.msg('容重输入错误')
  503. return
  504. }
  505. if (this.deptList.jiaorenli && this.deptList.jiaorenli < 1 ||
  506. this.deptList.jiaorenli && this.deptList.jiaorenli > 40) {
  507. this.$api.msg('热损伤输入错误')
  508. return
  509. }
  510. if (this.deptList.jiaorenli && this.deptList.jiaorenli.indexOf('.') != -1) {
  511. if (this.deptList.jiaorenli.split('.')[1].length > 2) {
  512. this.$api.msg('热损伤输入错误')
  513. return
  514. }
  515. }
  516. if (this.deptList.impurity && this.deptList.impurity < 1 ||
  517. this.deptList.impurity && this.deptList.impurity > 40) {
  518. this.$api.msg('杂质输入错误')
  519. return
  520. }
  521. if (this.deptList.impurity && this.deptList.impurity.indexOf('.') != -1) {
  522. if (this.deptList.impurity.split('.')[1].length > 2) {
  523. this.$api.msg('杂质输入错误')
  524. return
  525. }
  526. }
  527. if (this.deptList.mildewGrain && this.deptList.mildewGrain < 1 ||
  528. this.deptList.mildewGrain && this.deptList.mildewGrain > 40) {
  529. this.$api.msg('霉变粒输入错误')
  530. return
  531. }
  532. if (this.deptList.mildewGrain && this.deptList.mildewGrain.indexOf('.') != -1) {
  533. if (this.deptList.mildewGrain.split('.')[1].length > 2) {
  534. this.$api.msg('霉变粒输入错误')
  535. return
  536. }
  537. }
  538. if (this.deptList.imperfectGrain && this.deptList.imperfectGrain < 1 ||
  539. this.deptList.imperfectGrain && this.deptList.imperfectGrain > 40) {
  540. this.$api.msg('不完整粒输入错误')
  541. return
  542. }
  543. if (this.deptList.imperfectGrain && this.deptList.imperfectGrain.indexOf('.') != -1) {
  544. if (this.deptList.imperfectGrain.split('.')[1].length > 2) {
  545. this.$api.msg('不完整粒输入错误')
  546. return
  547. }
  548. }
  549. if (this.deptList.protein && this.deptList.protein < 1 ||
  550. this.deptList.protein && this.deptList.protein > 80) {
  551. this.$api.msg('蛋白输入错误')
  552. return
  553. }
  554. if (this.deptList.protein && this.deptList.protein.indexOf('.') != -1) {
  555. if (this.deptList.protein.split('.')[1].length > 2) {
  556. this.$api.msg('蛋白输入错误')
  557. return
  558. }
  559. }
  560. }
  561. this.insertProcurementPlanInfo = this.deptList
  562. this.insertProcurementPlanInfo.basisPrice = -this.insertProcurementPlanInfo.basisPrice
  563. this.insertProcurementPlanInfo.commonId = this.userInfo.id
  564. this.insertProcurementPlanInfo.procurementPlanNo='CGJH'+this.getdate()+this.verifyinit()
  565. this.insertProcurementPlanInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  566. var that = this
  567. this.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  568. phone: this.deptList.buyerPhone,
  569. verifyCode: this.verifyCode
  570. }).then(res => {
  571. if (res.data.code == 200) {
  572. that.$api.doRequest('post', '/procurementPlanInfo/api/insertProcurementPlanInfo', that
  573. .insertProcurementPlanInfo).then(res => {
  574. if (res.data.code == 200) {
  575. uni.showToast({
  576. title: "发布成功",
  577. icon: 'none',
  578. })
  579. // setTimeout(() => {
  580. // uni.navigateBack({})
  581. // }, 1000)
  582. that.deptList = {}
  583. uni.navigateTo({
  584. url: `/pages/release/release`
  585. })
  586. } else {
  587. uni.showToast({
  588. title: res.data.message,
  589. icon: 'none',
  590. duration: 2000
  591. })
  592. }
  593. })
  594. .catch(res => {
  595. uni.showToast({
  596. title: res.errmsg,
  597. icon: 'none',
  598. duration: 2000
  599. })
  600. });
  601. }
  602. else if(res.data.code=='11003'){
  603. uni.showModal({
  604. title: '提示',
  605. content: '验证码不正确',
  606. });
  607. }
  608. else {
  609. uni.showToast({
  610. title: res.data.message,
  611. icon: 'none',
  612. duration: 2000
  613. })
  614. }
  615. })
  616. .catch(res => {
  617. uni.showToast({
  618. title: res.data.message,
  619. icon: 'none',
  620. duration: 2000
  621. })
  622. });
  623. },
  624. liChange(e) {
  625. this.liIndex = e.detail.value
  626. this.litypes = this.liType[this.liIndex];
  627. this.deptList.grainKey = e.detail.value + 1
  628. this.deptList.grain = this.liType[this.liIndex]
  629. },
  630. pinChange(e) {
  631. this.pinIndex = e.detail.value
  632. this.pintypes = this.pinType[this.pinIndex];
  633. this.deptList.gradeKey = e.detail.value
  634. this.deptList.grade = this.pinType[this.pinIndex]
  635. },
  636. nianChange(e) {
  637. this.nianType = e.detail.value
  638. this.niantypes = this.nianType[this.nianIndex];
  639. this.deptList.outputYear = this.nianType[this.nianType]
  640. },
  641. baoChange(e) {
  642. this.baoIndex = e.detail.value
  643. this.baotypes = this.baoType[this.baoIndex];
  644. this.deptList.packingTypeKey = e.detail.value
  645. this.deptList.packingType = this.baoType[this.baoIndex];
  646. },
  647. getdate() {
  648. var date = new Date()
  649. var year = date.getFullYear() //获取完整的年份(4位)
  650. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  651. var datetime = date.getDate() //获取当前日(1-31)
  652. if (mouth < 10) {
  653. mouth = '0' + mouth
  654. }
  655. if (datetime < 10) {
  656. datetime = '0' + datetime
  657. }
  658. return year + mouth + datetime
  659. },
  660. verifyinit() {
  661. var arr = []
  662. for (var i = 48; i < 123; i++) {
  663. if (i > 57 && i < 65) continue
  664. if (i > 90 && i < 97) continue
  665. arr.push(String.fromCharCode(i))
  666. }
  667. arr.sort(function() {
  668. return Math.random() - 0.5
  669. })
  670. arr.length = 4
  671. return arr.join('')
  672. },
  673. chengChange(e) {
  674. this.chengIndex = e.detail.value
  675. this.chengtypes = this.chengType[this.chengIndex];
  676. this.deptList.freightPayerKey = e.detail.value + 1
  677. this.deptList.freightPayer = this.chengType[this.chengIndex];
  678. }
  679. }
  680. }
  681. </script>
  682. <style>
  683. .center {
  684. padding: 10px 20px;
  685. background-color: #F5F6FA;
  686. }
  687. .c-row {
  688. display: -webkit-box;
  689. display: -webkit-flex;
  690. display: flex;
  691. -webkit-box-align: center;
  692. -webkit-align-items: center;
  693. align-items: center;
  694. padding: 20rpx 30rpx;
  695. position: relative;
  696. }
  697. .con-list {
  698. -webkit-box-flex: 1;
  699. -webkit-flex: 1;
  700. flex: 1;
  701. display: -webkit-box;
  702. display: -webkit-flex;
  703. display: flex;
  704. -webkit-box-orient: vertical;
  705. -webkit-box-direction: normal;
  706. -webkit-flex-direction: column;
  707. flex-direction: column;
  708. color: #AFB3BF;
  709. line-height: 40rpx;
  710. text-align: right;
  711. padding-right: 20rpx;
  712. font-size: 14px;
  713. }
  714. .buyup {
  715. background-color: #FFFFFF;
  716. border-radius: 20px;
  717. margin-top: 10px;
  718. }
  719. .buylow {
  720. background-color: #FFFFFF;
  721. border-radius: 20px;
  722. margin-top: 10px;
  723. }
  724. .btn {
  725. border-radius: 20px;
  726. margin-top: 10px;
  727. background-color: #22C572;
  728. color: #FFFFFF;
  729. }
  730. .validate {
  731. width: 100px;
  732. height: 32px;
  733. background-color: #F5F6F9;
  734. color: #AFB3BF;
  735. border-radius: 10px;
  736. border: none;
  737. text-align: center;
  738. line-height: 30px;
  739. }
  740. .getcode {
  741. font-size: 14px;
  742. position: absolute;
  743. top: 50%;
  744. transform: translateY(-50%);
  745. color: #AFB3BF;
  746. background: #F5F6F9;
  747. height: 30px;
  748. line-height: 30px;
  749. }
  750. .getcode.active {
  751. border: none;
  752. }
  753. .getcode.active {
  754. background: #22C572;
  755. color: #fff;
  756. }
  757. </style>