buyGrain.vue 24 KB

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