sellGrain.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861
  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: 1,
  202. // grainKey: 0,
  203. // gradeKey: 0,
  204. // packingTypeKey: 0,
  205. // freightPayerKey: -1,
  206. priceType: "定价销售",
  207. priceTypeKey: 2,
  208. grain: "",
  209. grade: "一等品",
  210. packingType: "散装",
  211. freightPayer: "",
  212. },
  213. params: {
  214. province: true,
  215. city: true,
  216. area: true,
  217. },
  218. params1: {
  219. province: true,
  220. city: true,
  221. },
  222. checked: true,
  223. insertSalePlanInfo: {},
  224. liIndex: -1,
  225. liType: ['塔粮', '筛粮', '中粒', '大粒'],
  226. pinIndex: -1,
  227. pinType: ['一等品', '二等品', '三等品', '等外'],
  228. show: false,
  229. show1: false,
  230. show2:false,
  231. region: '请选择发货地区',
  232. regions: "",
  233. region1: '请选择产地',
  234. region2: "",
  235. baoIndex: -1,
  236. baoType: ['散装', '大袋', '小袋'],
  237. chengIndex: -1,
  238. chengType: ['可议', '买方承担', '卖方承担'],
  239. codestatus: false,
  240. sendDisabled: false,
  241. sendText: '获取验证码',
  242. verifyCode:"",
  243. verification:true,
  244. params2: {
  245. year: true,
  246. },
  247. morestatus:false
  248. }
  249. },
  250. computed: {
  251. ...mapState(['hasLogin', 'userInfo']),
  252. startData(){
  253. var data = new Date()
  254. return data.getFullYear() - 30
  255. },
  256. endData(){
  257. var data = new Date()
  258. return data.getFullYear()
  259. }
  260. },
  261. onLoad(options) {
  262. if (options.customerName) {
  263. this.deptList.seller = options.customerName
  264. }
  265. },
  266. onShow() {
  267. if( this.$store.state.choice != "" ){
  268. if(this.goods.customerTypeFlag==1){
  269. this.goods.customerName = this.$store.state.choice
  270. }else if(this.goods.customerTypeFlag==2){
  271. this.goods.compName = this.$store.state.choice
  272. }
  273. }else{
  274. var that = this
  275. this.$api.doRequest('get', '/identityAuthenticationInfo/getInfo', {
  276. commonId: this.userInfo.id
  277. }).then(res => {
  278. if (res.data.code == 200) {
  279. if (res.data.data.customerTypeFlag == 1) {
  280. that.$set(this.deptList, 'seller', res.data.data.customerName)
  281. } else {
  282. that.$set(this.deptList, 'seller', res.data.data.compName)
  283. }
  284. this.goods = res.data.data
  285. }
  286. uni.hideLoading()
  287. })
  288. }
  289. },
  290. methods: {
  291. yearchange() {
  292. this.show2 = true
  293. },
  294. moreinput(e){
  295. if(e.detail.value.length>0){
  296. this.morestatus=true
  297. }else{
  298. this.morestatus=false
  299. }
  300. },
  301. yearpicker(e) {
  302. if(e!=null){
  303. this.morestatus=true
  304. }else{
  305. this.morestatus=false
  306. }
  307. this.deptList.outputYear = e.year
  308. },
  309. // async amendprice() {
  310. // var that = this
  311. // this.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  312. // phone: this.deptList.buyerPhone,
  313. // verifyCode: this.verifyCode
  314. // }).then(res => {
  315. // if (res.data.code == 200) {
  316. // } else {
  317. // that.verification = false
  318. // uni.showToast({
  319. // title: res.data.message,
  320. // icon: 'none',
  321. // duration: 2000
  322. // })
  323. // return false
  324. // }
  325. // })
  326. // .catch(res => {
  327. // that.verification = false
  328. // uni.showToast({
  329. // title: res.data.message,
  330. // icon: 'none',
  331. // duration: 2000
  332. // })
  333. // return false
  334. // });
  335. // },
  336. phoneinput(e){
  337. if(e.detail.value.length==11){
  338. this.codestatus=true
  339. }
  340. },
  341. getcode() {
  342. var that = this
  343. if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(that.deptList.sellerPhone)) {
  344. this.$api.doRequest('get', '/commonUser/sendVerifyCode', {
  345. phone: that.deptList.sellerPhone
  346. }).then(res => {
  347. if (res.data.code == 200) {
  348. that.sendDisabled = true
  349. let sec = 60
  350. let interval = setInterval(() => {
  351. sec--;
  352. that.sendText = sec + 's后重发'
  353. if (sec <= 0) {
  354. that.sendDisabled = false
  355. that.sendText = "获取验证码"
  356. clearInterval(interval)
  357. }
  358. }, 1000)
  359. } else {
  360. uni.showToast({
  361. title: res.data.message,
  362. icon: 'none',
  363. duration: 2000
  364. })
  365. return
  366. }
  367. })
  368. .catch(res => {
  369. uni.showToast({
  370. title: res.data.message,
  371. icon: 'none',
  372. duration: 2000
  373. })
  374. return
  375. });
  376. } else {
  377. uni.showToast({
  378. title: '请输入正确的手机号',
  379. icon: 'none',
  380. duration: 2000
  381. })
  382. }
  383. },
  384. regionpicker(e) {
  385. this.deptList.sendPrivate = e.province.label
  386. this.deptList.sendCity = e.city.label
  387. this.deptList.sendArea = e.area.label
  388. this.region = e.province.label + '-' + e.city.label + '-' + e.area.label
  389. this.regions = e.province.label + '-' + e.city.label + '-' + e.area.label
  390. },
  391. regionchange() {
  392. this.show = true
  393. },
  394. regionpicker1(e) {
  395. this.deptList.outputPrivate = e.province.label
  396. this.deptList.outputCity = e.city.label
  397. this.region1 = e.province.label + '-' + e.city.label
  398. this.region2 = e.province.label + '-' + e.city.label
  399. },
  400. regionchange1() {
  401. this.show1 = true
  402. },
  403. checkedbox(e) {
  404. this.checked = !this.checked
  405. },
  406. typeChange(e) {
  407. this.typesIndex = e.detail.value
  408. this.types = this.typesType[this.typesIndex];
  409. this.deptList.salePlanTypeKey = e.detail.value
  410. this.deptList.salePlanType = this.typesType[this.typesIndex];
  411. if (this.typesIndex == 0) {
  412. this.deptList.priceType = '定价销售'
  413. } else {
  414. this.deptList.priceType = '期货盘面价+基差'
  415. }
  416. },
  417. navToDetailPage() {
  418. // if (index == 1) {
  419. uni.navigateTo({
  420. url: `/pageD/myRelease/Identity_switching?status=2`
  421. })
  422. },
  423. commit() {
  424. if (!this.deptList.title) {
  425. this.$api.msg('标题不能为空')
  426. return
  427. }
  428. if (this.deptList.title.length > 16 || this.deptList.title.length < 2) {
  429. this.$api.msg('标题输入错误')
  430. return
  431. }
  432. if (!this.deptList.goodsName) {
  433. this.$api.msg('货名不能为空')
  434. return
  435. }
  436. if (this.deptList.goodsName.length > 6 || this.deptList.goodsName.length < 1) {
  437. this.$api.msg('货名输入错误')
  438. return
  439. }
  440. if (!this.deptList.plannedSaleVolume) {
  441. this.$api.msg('出售量不能为空')
  442. return
  443. }
  444. if (this.deptList.plannedSaleVolume > 100000 || this.deptList.plannedSaleVolume < 1) {
  445. this.$api.msg('出售量输入错误')
  446. return
  447. }
  448. if (this.deptList.plannedSaleVolume.indexOf('.') != -1) {
  449. if (this.deptList.plannedSaleVolume.split('.')[1].length > 2) {
  450. this.$api.msg('出售量输入错误')
  451. return
  452. }
  453. }
  454. if (!this.deptList.minimumVolume) {
  455. this.$api.msg('最小成交量不能为空')
  456. return
  457. }
  458. if (this.deptList.minimumVolume > 100000 || this.deptList.minimumVolume < 1) {
  459. this.$api.msg('最小成交量输入错误')
  460. return
  461. }
  462. if (this.deptList.minimumVolume.indexOf('.') != -1) {
  463. if (this.deptList.minimumVolume.split('.')[1].length > 2) {
  464. this.$api.msg('最小成交量输入错误')
  465. return
  466. }
  467. }
  468. if (!this.deptList.salePlanType) {
  469. this.$api.msg('类型不能为空')
  470. return
  471. }
  472. if (!this.deptList.priceType) {
  473. this.$api.msg('价格类型不能为空')
  474. return
  475. }
  476. if (this.deptList.salePlanType == '现货') {
  477. if (!this.deptList.salePrice) {
  478. this.$api.msg('单价不能为空')
  479. return
  480. }
  481. if (this.deptList.salePrice > 100000 || this.deptList.salePrice < 1) {
  482. this.$api.msg('单价输入错误')
  483. return
  484. }
  485. if (this.deptList.salePrice.indexOf('.') != -1) {
  486. if (this.deptList.salePrice.split('.')[1].length > 2) {
  487. this.$api.msg('单价输入错误')
  488. return
  489. }
  490. }
  491. } else if (this.deptList.salePlanType == '期货') {
  492. if (!String(this.deptList.basisPrice)) {
  493. this.$api.msg('基差(元/吨)不能为空')
  494. return
  495. }
  496. if (this.deptList.basisPrice > 10000 || this.deptList.basisPrice < 0) {
  497. this.$api.msg('基差输入错误')
  498. return
  499. }
  500. if (this.deptList.basisPrice.indexOf('.') != -1) {
  501. if (this.deptList.basisPrice.split('.')[1].length > 2) {
  502. this.$api.msg('基差输入错误')
  503. return
  504. }
  505. }
  506. }
  507. if (!this.regions) {
  508. this.$api.msg('发货地区不能为空')
  509. return
  510. }
  511. if (!this.region2) {
  512. this.$api.msg('产地不能为空')
  513. return
  514. }
  515. if (!this.deptList.sellerPhone) {
  516. this.$api.msg('卖方手机号不能为空')
  517. return
  518. }
  519. if (this.deptList.sellerPhone.length != 11) {
  520. this.$api.msg('卖方手机号输入错误')
  521. return
  522. }
  523. if (!this.verifyCode) {
  524. this.$api.msg('验证码不能为空')
  525. return
  526. }
  527. if (this.checked == false) {
  528. if (this.deptList.waterContent && this.deptList.waterContent < 0 ||
  529. this.deptList.waterContent && this.deptList.waterContent > 40) {
  530. this.$api.msg('水分输入错误')
  531. return
  532. }
  533. if (this.deptList.waterContent && this.deptList.waterContent.indexOf('.') != -1) {
  534. if (this.deptList.waterContent.split('.')[1].length > 2) {
  535. this.$api.msg('水分输入错误')
  536. return
  537. }
  538. }
  539. if (this.deptList.bulkDensity && this.deptList.bulkDensity < 0 ||
  540. this.deptList.bulkDensity && this.deptList.bulkDensity > 1000) {
  541. this.$api.msg('容重输入错误')
  542. return
  543. }
  544. if (this.deptList.jiaorenli && this.deptList.jiaorenli < 0 ||
  545. this.deptList.jiaorenli && this.deptList.jiaorenli > 40) {
  546. this.$api.msg('热损伤输入错误')
  547. return
  548. }
  549. if (this.deptList.jiaorenli && this.deptList.jiaorenli.indexOf('.') != -1) {
  550. if (this.deptList.jiaorenli.split('.')[1].length > 2) {
  551. this.$api.msg('热损伤输入错误')
  552. return
  553. }
  554. }
  555. if (this.deptList.impurity && this.deptList.impurity < 0 ||
  556. this.deptList.impurity && this.deptList.impurity > 40) {
  557. this.$api.msg('杂质输入错误')
  558. return
  559. }
  560. if (this.deptList.impurity && this.deptList.impurity.indexOf('.') != -1) {
  561. if (this.deptList.impurity.split('.')[1].length > 2) {
  562. this.$api.msg('杂质输入错误')
  563. return
  564. }
  565. }
  566. if (this.deptList.mildewGrain && this.deptList.mildewGrain < 0 ||
  567. this.deptList.mildewGrain && this.deptList.mildewGrain > 40) {
  568. this.$api.msg('霉变粒输入错误')
  569. return
  570. }
  571. if (this.deptList.mildewGrain && this.deptList.mildewGrain.indexOf('.') != -1) {
  572. if (this.deptList.mildewGrain.split('.')[1].length > 2) {
  573. this.$api.msg('霉变粒输入错误')
  574. return
  575. }
  576. }
  577. if (this.deptList.imperfectGrain && this.deptList.imperfectGrain < 0 ||
  578. this.deptList.imperfectGrain && this.deptList.imperfectGrain > 40) {
  579. this.$api.msg('不完整粒输入错误')
  580. return
  581. }
  582. if (this.deptList.imperfectGrain && this.deptList.imperfectGrain.indexOf('.') != -1) {
  583. if (this.deptList.imperfectGrain.split('.')[1].length > 2) {
  584. this.$api.msg('不完整粒输入错误')
  585. return
  586. }
  587. }
  588. if (this.deptList.protein && this.deptList.protein < 0 ||
  589. this.deptList.protein && this.deptList.protein > 80) {
  590. this.$api.msg('蛋白输入错误')
  591. return
  592. }
  593. if (this.deptList.protein && this.deptList.protein.indexOf('.') != -1) {
  594. if (this.deptList.protein.split('.')[1].length > 2) {
  595. this.$api.msg('蛋白输入错误')
  596. return
  597. }
  598. }
  599. }
  600. // if(this.amendprice() == false){
  601. // this.$api.msg('验证码输入有误!')
  602. // return
  603. // }
  604. var that = this
  605. this.insertSalePlanInfo = this.deptList
  606. this.insertSalePlanInfo.basisPrice = this.insertSalePlanInfo.basisPrice
  607. this.insertSalePlanInfo.commonId = this.userInfo.id
  608. this.insertSalePlanInfo.salePlanNo = 'XSJH' + this.getdate() + this.verifyinit()
  609. this.insertSalePlanInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  610. uni.showModal({
  611. title: '提示',
  612.     content: '确定发布交易信息?',
  613.     success: function (res) {
  614. if (res.confirm) {
  615. that.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  616. phone: that.deptList.sellerPhone,
  617. verifyCode: that.verifyCode
  618. }).then(res => {
  619. if (res.data.code == 200) {
  620. that.$api.doRequest('post', '/salePlanInfo/api/insertSalePlanInfo', that
  621. .insertSalePlanInfo).then(res => {
  622. if (res.data.code == 200) {
  623. uni.showToast({
  624. title:'发布成功',
  625. icon: 'none',
  626. duration: 2000,
  627. success() {
  628. setTimeout(()=>{
  629. uni.navigateTo({
  630. url: `/pages/release/release`
  631. })
  632. },2000)
  633. }
  634. })
  635. that.deptList = {}
  636. } else {
  637. uni.showToast({
  638. title: res.data.message,
  639. icon: 'none',
  640. duration: 2000
  641. })
  642. }
  643. })
  644. .catch(res => {
  645. if(res.errmsg){
  646. uni.showToast({
  647. title: res.errmsg,
  648. icon: 'none',
  649. duration: 2000
  650. })
  651. }
  652. else{
  653. uni.showToast({
  654. title: "系统异常,请联系管理员",
  655. icon: 'none',
  656. duration: 2000
  657. })
  658. }
  659. });
  660. } else if (res.data.code == '11003') {
  661. uni.showModal({
  662. title: '提示',
  663. content: '验证码不正确',
  664. });
  665. } else {
  666. uni.showToast({
  667. title: res.data.message,
  668. icon: 'none',
  669. duration: 2000
  670. })
  671. return
  672. }
  673. })
  674. .catch(res => {
  675. uni.showToast({
  676. title: res.data.message,
  677. icon: 'none',
  678. duration: 2000
  679. })
  680. return
  681. });
  682. } else if (res.cancel) {
  683. }
  684. }});
  685. // this.insertProcurementPlanInfo = this.deptList
  686. // this.insertProcurementPlanInfo.basisPrice = -this.insertProcurementPlanInfo.basisPrice
  687. // this.insertProcurementPlanInfo.commonId = this.userInfo.id
  688. // this.insertProcurementPlanInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  689. },
  690. liChange(e) {
  691. if(e.detail.value!=-1){
  692. this.morestatus=true
  693. }else{
  694. this.morestatus=false
  695. }
  696. this.liIndex = e.detail.value
  697. this.litypes = this.liType[this.liIndex];
  698. this.deptList.grainKey = e.detail.value
  699. this.deptList.grain = this.liType[this.liIndex]
  700. },
  701. pinChange(e) {
  702. if(e.detail.value!=-1){
  703. this.morestatus=true
  704. }else{
  705. this.morestatus=false
  706. }
  707. this.pinIndex = e.detail.value
  708. this.pintypes = this.pinType[this.pinIndex];
  709. this.deptList.gradeKey = e.detail.value
  710. this.deptList.grade = this.pinType[this.pinIndex]
  711. },
  712. baoChange(e) {
  713. if(e.detail.value!=-1){
  714. this.morestatus=true
  715. }else{
  716. this.morestatus=false
  717. }
  718. this.baoIndex = e.detail.value
  719. this.baotypes = this.baoType[this.baoIndex];
  720. this.deptList.packingTypeKey = e.detail.value
  721. this.deptList.packingType = this.baoType[this.baoIndex];
  722. },
  723. getdate() {
  724. var date = new Date()
  725. var year = date.getFullYear() //获取完整的年份(4位)
  726. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  727. var datetime = date.getDate() //获取当前日(1-31)
  728. if (mouth < 10) {
  729. mouth = '0' + mouth
  730. }
  731. if (datetime < 10) {
  732. datetime = '0' + datetime
  733. }
  734. return year + mouth + datetime
  735. },
  736. verifyinit() {
  737. var arr = []
  738. for (var i = 48; i < 123; i++) {
  739. if (i > 57 && i < 65) continue
  740. if (i > 90 && i < 97) continue
  741. arr.push(String.fromCharCode(i))
  742. }
  743. arr.sort(function() {
  744. return Math.random() - 0.5
  745. })
  746. arr.length = 4
  747. return arr.join('')
  748. },
  749. chengChange(e) {
  750. if(e.detail.value!=-1){
  751. this.morestatus=true
  752. }else{
  753. this.morestatus=false
  754. }
  755. this.chengIndex = e.detail.value
  756. this.chengtypes = this.chengType[this.chengIndex];
  757. this.deptList.freightPayerKey = e.detail.value + 1
  758. this.deptList.freightPayer = this.chengType[this.chengIndex];
  759. }
  760. }
  761. }
  762. </script>
  763. <style>
  764. .center {
  765. padding: 10px 20px;
  766. background-color: #F5F6FA;
  767. }
  768. .c-row {
  769. display: -webkit-box;
  770. display: -webkit-flex;
  771. display: flex;
  772. -webkit-box-align: center;
  773. -webkit-align-items: center;
  774. align-items: center;
  775. padding: 20rpx 30rpx;
  776. position: relative;
  777. font-size:14px;
  778. }
  779. .con-list {
  780. -webkit-box-flex: 1;
  781. -webkit-flex: 1;
  782. flex: 1;
  783. display: -webkit-box;
  784. display: -webkit-flex;
  785. display: flex;
  786. -webkit-box-orient: vertical;
  787. -webkit-box-direction: normal;
  788. -webkit-flex-direction: column;
  789. flex-direction: column;
  790. line-height: 40rpx;
  791. text-align: right;
  792. padding-right: 20rpx;
  793. }
  794. .con-list input{
  795. font-size:14px !important;
  796. }
  797. .buyup {
  798. background-color: #FFFFFF;
  799. border-radius: 20px;
  800. margin-top: 10px;
  801. }
  802. .buylow {
  803. background-color: #FFFFFF;
  804. border-radius: 20px;
  805. margin-top: 10px;
  806. }
  807. .btn {
  808. border-radius: 20px;
  809. margin-top: 10px;
  810. background-color: #22C572;
  811. color: #FFFFFF;
  812. }
  813. .validate {
  814. width: 100px;
  815. height: 32px;
  816. background-color: #F5F6F9;
  817. color: #AFB3BF;
  818. border-radius: 10px;
  819. border: none;
  820. text-align: center;
  821. line-height: 30px;
  822. }
  823. .getcode {
  824. font-size: 14px;
  825. color: #AFB3BF;
  826. background: #F5F6F9;
  827. height: 30px;
  828. line-height: 30px;
  829. }
  830. .getcode.active {
  831. border: none;
  832. }
  833. .getcode.active {
  834. background: #22C572;
  835. color: #fff;
  836. }
  837. </style>