sellEdit.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032
  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. <!-- <view class="con-list">
  38. {{deptList.salePlanType}}
  39. </view> -->
  40. <picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
  41. <view class="picker" v-model="deptList.salePlanType">
  42. {{typesIndex>-1?typesType[typesIndex]:'请选择类型'}}
  43. </view>
  44. </picker>
  45. </view>
  46. <view class="c-row b-b">
  47. <text class="tit">价格类型</text>
  48. <view class="con-list">
  49. {{deptList.priceType}}
  50. </view>
  51. </view>
  52. <view class="c-row b-b" v-if="this.typesIndex != 1">
  53. <text class="tit">单价(元/吨)</text>
  54. <view class="con-list">
  55. <input placeholder="请填写单价" name="input" v-model="deptList.salePrice"></input>
  56. </view>
  57. </view>
  58. <view class="c-row b-b" v-if="this.typesIndex == 1">
  59. <text class="tit">基差(元/吨)</text>
  60. <view class="con-list">
  61. <input placeholder="请输入基差" name="input" v-model="deptList.basisPrice"></input>
  62. </view>
  63. </view>
  64. <view class="c-row b-b">
  65. <text class="tit">产地</text>
  66. <view class="con-list">
  67. <view @click='regionchange1'>{{region1}}</view>
  68. <u-picker :params='params1' @confirm='regionpicker1' mode="region" v-model="show1"></u-picker>
  69. </view>
  70. </view>
  71. <view class="c-row b-b">
  72. <text class="tit">发货地区</text>
  73. <view class="con-list">
  74. <view @click='regionchange'>{{region}}</view>
  75. <u-picker :params='params' @confirm='regionpicker' mode="region" v-model="show"></u-picker>
  76. </view>
  77. </view>
  78. <view class="c-row b-b">
  79. <text class="tit">卖方手机号</text>
  80. <view class="con-list">
  81. <input placeholder="请输入买方手机号" name="input" v-model="deptList.sellerPhone"></input>
  82. </view>
  83. </view>
  84. <view class="c-row">
  85. <button :class='codestatus&&!sendDisabled?"active":""' @click='getcode'
  86. class='getcode'>{{sendText}}</button>
  87. <view class="con-list">
  88. <input v-model='verifyCode' maxlength="6" placeholder="请输入验证码" type="text">
  89. </view>
  90. </view>
  91. </view>
  92. <view class="buylow">
  93. <view class="c-row ">
  94. <checkbox style='transform: scale(0.8);' :checked="checked" @click='checkedbox'></checkbox><text
  95. style="font-size: 14px; ">完善更多信息<text
  96. style="font-size: 10px; color: #AFB3BF;">(选填,可由客服人员代为完善)</text></text>
  97. </view>
  98. <view v-if='checked' class="c-row b-b">
  99. <text class="tit">水分(%)<= </text>
  100. <view class="con-list">
  101. <input placeholder="请填写水分占比" name="input" v-model="deptList.waterContent"></input>
  102. </view>
  103. </view>
  104. <view v-if='checked' class="c-row b-b">
  105. <text class="tit">容重(g/L)<= </text>
  106. <view class="con-list">
  107. <input placeholder="请填写容重" name="input" v-model="deptList.bulkDensity"></input>
  108. </view>
  109. </view>
  110. <view v-if='checked' class="c-row b-b">
  111. <text class="tit">热损伤(%)<= </text>
  112. <view class="con-list">
  113. <input placeholder="请填写热损伤占比" name="input" v-model="deptList.jiaorenli"></input>
  114. </view>
  115. </view>
  116. <view v-if='checked' class="c-row b-b">
  117. <text class="tit">杂质(%)<= </text>
  118. <view class="con-list">
  119. <input placeholder="请填写杂质占比" name="input" v-model="deptList.impurity"></input>
  120. </view>
  121. </view>
  122. <view v-if='checked' class="c-row b-b">
  123. <text class="tit">霉变粒(%)<= </text>
  124. <view class="con-list">
  125. <input placeholder="请填写霉变粒占比" name="input" v-model="deptList.mildewGrain"></input>
  126. </view>
  127. </view>
  128. <view v-if='checked' class="c-row b-b">
  129. <text class="tit">不完整粒(%)<= </text>
  130. <view class="con-list">
  131. <input placeholder="请填写不完整粒占比" name="input" v-model="deptList.imperfectGrain"></input>
  132. </view>
  133. </view>
  134. <view v-if='checked' class="c-row b-b">
  135. <text class="tit">蛋白(%)<= </text>
  136. <view class="con-list">
  137. <input placeholder="请填写蛋白占比" name="input" v-model="deptList.protein"></input>
  138. </view>
  139. </view>
  140. <view v-if='checked' class="c-row b-b">
  141. <text class="tit">粒型 </text>
  142. <picker @change="liChange" :value="liIndex" :range="liType" class="con-list" v-model="deptList.grain">
  143. <view class="con-list">
  144. {{liIndex>-1?liType[liIndex]:'请选择粒型'}}
  145. </view>
  146. </picker>
  147. </view>
  148. <view v-if='checked' class="c-row b-b">
  149. <text class="tit">品级 </text>
  150. <picker @change="pinChange" :value="pinIndex" :range="pinType" class="con-list">
  151. <view class="con-list">
  152. {{pinIndex>-1?pinType[pinIndex]:'请选择品级'}}
  153. </view>
  154. </picker>
  155. </view>
  156. <view v-if='checked' class="c-row b-b">
  157. <text class="tit">产出年份</text>
  158. <view class="con-list">
  159. <view @click='yearchange'>{{deptList.outputYear == null?"请选择出厂年份":deptList.outputYear}}</view>
  160. <u-picker :params='params2' @confirm='yearpicker($event)' v-model="show2" mode="time"
  161. :start-year="startData" :end-year="endData">
  162. </u-picker>
  163. </view>
  164. </view>
  165. <view v-if='checked' class="c-row b-b">
  166. <text class="tit">包装方式</text>
  167. <picker @change="baoChange" :value="baoIndex" :range="baoType" class="con-list">
  168. <view class="con-list">
  169. {{baoIndex>-1?baoType[baoIndex]:'请选择包装方式'}}
  170. </view>
  171. </picker>
  172. </view>
  173. <view v-if='checked&&baoIndex!=0' class="c-row b-b">
  174. <text class="tit">袋装备注</text>
  175. <view class="con-list">
  176. <input placeholder="请填写袋装备注" name="input" v-model="deptList.baggingNotes"></input>
  177. </view>
  178. </view>
  179. <view v-if='checked' class="c-row b-b">
  180. <text class="tit">运费承担方</text>
  181. <picker @change="chengChange" :value="chengIndex" :range="chengType" class="con-list">
  182. <view class="con-list">
  183. {{chengIndex>-1?chengType[chengIndex]:'请选择运费承担方'}}
  184. </view>
  185. </picker>
  186. </view>
  187. </view>
  188. <view class="remark">
  189. <view class="c-row b-b">
  190. <text class="tit">备注</text>
  191. </view>
  192. <view style='position:relative;' class="wrap no-boder">
  193. <u-input class='textarea' v-model="deptList.remark" :type="type" :border="border" :height="height"
  194. :auto-height="autoHeight" maxlength="500" />
  195. <!-- <view style='position:absolute;right:10px;bottom:20px;color:#AFB3BF;'>
  196. {{deptList.remark.length}}/500个字
  197. </view> -->
  198. </view>
  199. <view class="c-row b-b" style="display: block;">
  200. <text class="tit">附件</text>
  201. <view style="display: flex;flex-wrap: wrap;">
  202. <view v-for='(item,index) in imglist2' v-if="imglist2 && imglist2.length > 0"
  203. style="position: relative;margin-left: 20rpx;">
  204. <view class="delete_img" @click="deleteImg(index)">X</view>
  205. <image :src="item.appendixPath" mode="" style="width: 100px;height: 100px;"></image>
  206. </view>
  207. <view class="biankuang" @click="uploadClick" v-if="imglist2.length < 30">
  208. <view class="tubiao">
  209. <image class="upload" src="../../static/img/oa_office/upload.png" mode="">
  210. </image>
  211. <view class="" style="color:#8c8f98;">
  212. 选择图片
  213. </view>
  214. </view>
  215. </view>
  216. </view>
  217. </view>
  218. </view>
  219. <button @click="commit()" class="btn">重新发布</button>
  220. </view>
  221. </template>
  222. <script>
  223. import * as config from '../../config'
  224. import {
  225. mapState
  226. } from 'vuex';
  227. export default {
  228. data() {
  229. return {
  230. dotStyle: false,
  231. currentImg: 0,
  232. imgUrl: [],
  233. type: 'textarea',
  234. border: true,
  235. height: 150,
  236. autoHeight: true,
  237. types: '',
  238. goods: {},
  239. typesType: ["现货", "期货"],
  240. typesIndex: 0,
  241. deptList: {
  242. priceType: "定价采购",
  243. procurementPlanType: "现货",
  244. grain: "塔粮",
  245. grade: "一等品",
  246. outputYear: "2020",
  247. packingType: "可议",
  248. freightPayer: "",
  249. imglist2: [], //展示
  250. imglist: [], //存
  251. },
  252. imglist2: [], //展示
  253. imglist: [], //存
  254. params: {
  255. province: true,
  256. city: true,
  257. area: true,
  258. },
  259. params1: {
  260. province: true,
  261. city: true,
  262. },
  263. checked: true,
  264. codestatus: true,
  265. sendText: '获取验证码',
  266. sendDisabled: false,
  267. verifyCode: "",
  268. insertProcurementPlanInfo: {},
  269. liIndex: 0,
  270. liType: ['塔粮', '筛粮', '中粒', '大粒'],
  271. pinIndex: -1,
  272. pinType: ['一等品', '二等品', '三等品', '等外'],
  273. nianIndex: 3,
  274. show: false,
  275. show1: false,
  276. show2: false,
  277. region: '请选择收货地区',
  278. region1: '请选择产地',
  279. baoIndex: -1,
  280. baoType: ['散装', '大袋', '小袋'],
  281. chengIndex: -1,
  282. chengType: ['可议', '买方承担', '卖方承担'],
  283. params2: {
  284. year: true,
  285. },
  286. }
  287. },
  288. computed: {
  289. ...mapState(['hasLogin', 'userInfo']),
  290. startData() {
  291. var data = new Date()
  292. return data.getFullYear() - 30
  293. },
  294. endData() {
  295. var data = new Date()
  296. return data.getFullYear()
  297. }
  298. },
  299. onLoad(options) {
  300. this.getList(options)
  301. },
  302. onShow() {
  303. var that = this
  304. this.$api.doRequest('get', '/identityAuthenticationInfo/getInfo', {
  305. commonId: this.userInfo.id
  306. }).then(res => {
  307. if (res.data.code == 200) {
  308. if (res.data.data.customerTypeFlag == 1) {
  309. that.$set(this.deptList, 'seller', res.data.data.customerName)
  310. } else {
  311. that.$set(this.deptList, 'seller', res.data.data.compName)
  312. }
  313. this.goods = res.data.data
  314. }
  315. uni.hideLoading()
  316. })
  317. },
  318. watch: {
  319. imglist: {
  320. handler: function() {
  321. this.$api.doRequest('get', 'appendix/query/getFileList', {
  322. appendixIds: this.imglist.toString()
  323. }).then(res => {
  324. this.imglist2 = res.data.data
  325. for (let i = 0; i < this.imglist2.length; i++) {
  326. // if (this.imglist2[i].appendixName) {
  327. // this.imglist2[i].type = this.imglist2[i].appendixName.split(".")[1]
  328. // }
  329. if (this.imglist2[i].appendixPath) {
  330. this.imgUrl.push(this.imglist2[i].appendixPath)
  331. }
  332. }
  333. })
  334. },
  335. deep: true
  336. }
  337. },
  338. methods: {
  339. deleteImg(index) {
  340. this.imglist.splice(index, 1)
  341. },
  342. yearpicker(e) {
  343. if (e != null) {
  344. this.morestatus = true
  345. } else {
  346. this.morestatus = false
  347. }
  348. this.deptList.outputYear = e.year
  349. },
  350. yearchange() {
  351. this.show2 = true
  352. },
  353. async uploadClick() {
  354. let baseUrlNew = config.def().baseUrlNew
  355. console.log('baseUrlNew',baseUrlNew)
  356. uni.chooseImage({
  357. count:10,
  358. success: (chooseImageRes) => {
  359. console.log('chooseImageRes',chooseImageRes)
  360. let files = []
  361. for (let item of chooseImageRes.tempFiles) {
  362. files.push({
  363. name: 'fileName',
  364. url : item.path
  365. });
  366. }
  367. console.log(files)
  368. for (let i = 0; i < files.length; i++) {
  369. uni.uploadFile({
  370. url: baseUrlNew + 'appendix/api/uploadFiles',
  371. // url: baseUrlNew+'appendix/api/uploadFiles', //仅为示例,非真实的接口地址
  372. // files: files[i],
  373. filePath:files[i].url,
  374. name:files[i].name,
  375. formData: {
  376. // fileName: chooseImageRes.tempFiles[0],
  377. companyId: "2710b21efc1e4393930c5dc800010dc4",
  378. modelId: '',
  379. vesselId: '',
  380. },
  381. success: (uploadFileRes) => {
  382. console.log(JSON.parse(uploadFileRes.data))
  383. var data = JSON.parse(uploadFileRes.data).data
  384. this.$api.doRequest('post', '/appendix/api/saveFiles', {
  385. newAppendixs: [data],
  386. oldAppendixIds: ""
  387. }).then(res => {
  388. this.imglist.push(res.data.data[0])
  389. console.log(res)
  390. })
  391. console.log(uploadFileRes.data);
  392. },
  393. fail(res) {
  394. console.log(res);
  395. }
  396. });
  397. }
  398. }
  399. });
  400. },
  401. getList(options) {
  402. this.$api.doRequest('get', '/salePlanInfo/getSalePlanInfo', {
  403. id: options.id
  404. }).then(res => {
  405. if (res.data.code == 200) {
  406. this.deptList = res.data.data
  407. this.imglist = this.deptList.addressUrl.split(',')
  408. if (this.deptList.waterContent != null || this.deptList.bulkDensity != null || this
  409. .deptList.jiaorenli != null || this.deptList.impurity != null || this.deptList
  410. .mildewGrain != null || this.deptList.imperfectGrain != null || this.deptList
  411. .protein != null || this.deptList.grade != null || this.deptList.outputYear != null ||
  412. this.deptList.packingType != null || this.deptList.freightPayer != null) {
  413. this.checked = false
  414. }
  415. if (this.deptList.outputPrivate && this.deptList.outputCity) {
  416. this.region1 = this.deptList.outputPrivate + '-' + this.deptList.outputCity
  417. }
  418. this.region = this.deptList.sendPrivate + '-' + this.deptList.sendCity + '-' + this
  419. .deptList.sendArea
  420. // if(this.deptList.salePlanTypeKey==2){
  421. // this.typesIndex = 1
  422. // }else if(this.deptList.salePlanTypeKey==1){
  423. // this.typesIndex =0
  424. // }
  425. this.typesIndex = this.deptList.salePlanTypeKey - 1
  426. this.liIndex = this.deptList.grainKey
  427. this.baoIndex = this.deptList.packingTypeKey
  428. this.pinIndex = this.deptList.gradeKey
  429. if (this.deptList.freightPayerKey == 1) {
  430. this.chengIndex = 0
  431. } else if (this.deptList.freightPayerKey == 2) {
  432. this.chengIndex = 1
  433. } else if (this.deptList.freightPayerKey == 3) {
  434. this.chengIndex = 2
  435. }
  436. } else {
  437. uni.showToast({
  438. title: res.data.message,
  439. icon: 'none',
  440. duration: 2000
  441. })
  442. }
  443. })
  444. .catch(res => {
  445. if (res.errmsg) {
  446. uni.showToast({
  447. title: res.errmsg,
  448. icon: 'none',
  449. duration: 2000
  450. })
  451. } else {
  452. uni.showToast({
  453. title: "系统异常,请联系管理员",
  454. icon: 'none',
  455. duration: 2000
  456. })
  457. }
  458. });
  459. },
  460. getcode() {
  461. var that = this
  462. if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(that.deptList.sellerPhone)) {
  463. this.$api.doRequest('get', '/commonUser/sendVerifyCode', {
  464. phone: that.deptList.sellerPhone
  465. }).then(res => {
  466. if (res.data.code == 200) {
  467. that.sendDisabled = true
  468. let sec = 60
  469. let interval = setInterval(() => {
  470. sec--;
  471. that.sendText = sec + 's后重发'
  472. if (sec <= 0) {
  473. that.sendDisabled = false
  474. that.sendText = "获取验证码"
  475. clearInterval(interval)
  476. }
  477. }, 1000)
  478. } else {
  479. uni.showToast({
  480. title: res.data.message,
  481. icon: 'none',
  482. duration: 2000
  483. })
  484. return
  485. }
  486. })
  487. .catch(res => {
  488. uni.showToast({
  489. title: res.data.message,
  490. icon: 'none',
  491. duration: 2000
  492. })
  493. return
  494. });
  495. } else {
  496. uni.showToast({
  497. title: '请输入正确的手机号',
  498. icon: 'none',
  499. duration: 2000
  500. })
  501. }
  502. },
  503. regionpicker(e) {
  504. this.deptList.sendPrivate = e.province.label
  505. this.deptList.sendCity = e.city.label
  506. this.deptList.sendArea = e.area.label
  507. this.region = e.province.label + '-' + e.city.label + '-' + e.area.label
  508. },
  509. regionchange() {
  510. this.show = true
  511. },
  512. regionpicker1(e) {
  513. this.deptList.outputPrivate = e.province.label
  514. this.deptList.outputCity = e.city.label
  515. this.region1 = e.province.label + '-' + e.city.label
  516. },
  517. regionchange1() {
  518. this.show1 = true
  519. },
  520. checkedbox(e) {
  521. this.checked = !this.checked
  522. },
  523. typeChange(e) {
  524. this.typesIndex = e.detail.value
  525. this.types = this.typesType[this.typesIndex];
  526. this.deptList.salePlanTypeKey = e.detail.value
  527. this.deptList.salePlanType = this.typesType[this.typesIndex];
  528. if (this.typesIndex == 0) {
  529. this.deptList.priceType = '定价采购'
  530. } else {
  531. this.deptList.priceType = '期货盘面价+基差'
  532. }
  533. },
  534. navToDetailPage() {
  535. // if (index == 1) {
  536. uni.navigateTo({
  537. url: `/pageD/myRelease/Identity_switching`
  538. })
  539. },
  540. commit() {
  541. if (!this.deptList.title) {
  542. this.$api.msg('标题不能为空')
  543. return
  544. }
  545. if (this.deptList.title.length > 16 || this.deptList.title.length < 2) {
  546. this.$api.msg('标题输入错误')
  547. return
  548. }
  549. if (!this.deptList.goodsName) {
  550. this.$api.msg('货名不能为空')
  551. return
  552. }
  553. if (this.deptList.goodsName.length > 6 || this.deptList.goodsName.length < 1) {
  554. this.$api.msg('货名输入错误')
  555. return
  556. }
  557. if (!this.deptList.plannedSaleVolume) {
  558. this.$api.msg('出货量不能为空')
  559. return
  560. }
  561. if (this.deptList.plannedSaleVolume > 100000 || this.deptList.plannedSaleVolume < 1) {
  562. this.$api.msg('出货量输入错误')
  563. return
  564. }
  565. if (this.deptList.plannedSaleVolume.toString().indexOf('.') != -1) {
  566. if (this.deptList.plannedSaleVolume.split('.')[1].length > 2) {
  567. this.$api.msg('出货量输入错误')
  568. return
  569. }
  570. }
  571. if (!this.deptList.minimumVolume) {
  572. this.$api.msg('最小成交量不能为空')
  573. return
  574. }
  575. if (this.deptList.minimumVolume > 100000 || this.deptList.minimumVolume < 1) {
  576. this.$api.msg('最小成交量输入错误')
  577. return
  578. }
  579. if (this.deptList.minimumVolume.toString().indexOf('.') != -1) {
  580. if (this.deptList.minimumVolume.split('.')[1].length > 2) {
  581. this.$api.msg('最小成交量输入错误')
  582. return
  583. }
  584. }
  585. if (!this.deptList.salePlanType) {
  586. this.$api.msg('类型不能为空')
  587. return
  588. }
  589. if (!this.deptList.priceType) {
  590. this.$api.msg('价格类型不能为空')
  591. return
  592. }
  593. if (this.deptList.salePlanType == '现货') {
  594. if (!this.deptList.salePrice) {
  595. this.$api.msg('单价不能为空')
  596. return
  597. }
  598. if (this.deptList.salePrice > 100000 || this.deptList.salePrice < 1) {
  599. this.$api.msg('单价输入错误')
  600. return
  601. }
  602. if (this.deptList.salePrice.indexOf('.') != -1) {
  603. if (this.deptList.salePrice.split('.')[1].length > 2) {
  604. this.$api.msg('单价输入错误')
  605. return
  606. }
  607. }
  608. } else if (this.deptList.salePlanType == '期货') {
  609. if (!String(this.deptList.basisPrice)) {
  610. this.$api.msg('基差(元/吨)不能为空')
  611. return
  612. }
  613. // if (this.deptList.basisPrice > 10000 || this.deptList.basisPrice < 1) {
  614. // this.$api.msg('基差输入错误')
  615. // return
  616. // }
  617. // if (this.deptList.basisPrice.indexOf('.') != -1) {
  618. // if (this.deptList.basisPrice.split('.')[1].length > 2) {
  619. // this.$api.msg('基差输入错误')
  620. // return
  621. // }
  622. // }
  623. }
  624. if (!this.deptList.sellerPhone) {
  625. this.$api.msg('卖方手机号不能为空')
  626. return
  627. }
  628. if (!this.verifyCode) {
  629. this.$api.msg('验证码不能为空')
  630. return
  631. }
  632. if (this.checked == false) {
  633. if (this.deptList.waterContent && this.deptList.waterContent < 0 ||
  634. this.deptList.waterContent && this.deptList.waterContent > 40) {
  635. this.$api.msg('水分输入错误')
  636. return
  637. }
  638. if (this.deptList.waterContent && this.deptList.waterContent.indexOf('.') != -1) {
  639. if (this.deptList.waterContent.split('.')[1].length > 2) {
  640. this.$api.msg('水分输入错误')
  641. return
  642. }
  643. }
  644. if (this.deptList.bulkDensity && this.deptList.bulkDensity < 0 ||
  645. this.deptList.bulkDensity && this.deptList.bulkDensity > 1000) {
  646. this.$api.msg('容重输入错误')
  647. return
  648. }
  649. if (this.deptList.jiaorenli && this.deptList.jiaorenli < 0 ||
  650. this.deptList.jiaorenli && this.deptList.jiaorenli > 40) {
  651. this.$api.msg('热损伤输入错误')
  652. return
  653. }
  654. if (this.deptList.jiaorenli && this.deptList.jiaorenli.indexOf('.') != -1) {
  655. if (this.deptList.jiaorenli.split('.')[1].length > 2) {
  656. this.$api.msg('热损伤输入错误')
  657. return
  658. }
  659. }
  660. if (this.deptList.impurity && this.deptList.impurity < 0 ||
  661. this.deptList.impurity && this.deptList.impurity > 40) {
  662. this.$api.msg('杂质输入错误')
  663. return
  664. }
  665. if (this.deptList.impurity && this.deptList.impurity.indexOf('.') != -1) {
  666. if (this.deptList.impurity.split('.')[1].length > 2) {
  667. this.$api.msg('杂质输入错误')
  668. return
  669. }
  670. }
  671. if (this.deptList.mildewGrain && this.deptList.mildewGrain < 0 ||
  672. this.deptList.mildewGrain && this.deptList.mildewGrain > 40) {
  673. this.$api.msg('霉变粒输入错误')
  674. return
  675. }
  676. if (this.deptList.mildewGrain && this.deptList.mildewGrain.indexOf('.') != -1) {
  677. if (this.deptList.mildewGrain.split('.')[1].length > 2) {
  678. this.$api.msg('霉变粒输入错误')
  679. return
  680. }
  681. }
  682. if (this.deptList.imperfectGrain && this.deptList.imperfectGrain < 0 ||
  683. this.deptList.imperfectGrain && this.deptList.imperfectGrain > 40) {
  684. this.$api.msg('不完整粒输入错误')
  685. return
  686. }
  687. if (this.deptList.imperfectGrain && this.deptList.imperfectGrain.indexOf('.') != -1) {
  688. if (this.deptList.imperfectGrain.split('.')[1].length > 2) {
  689. this.$api.msg('不完整粒输入错误')
  690. return
  691. }
  692. }
  693. if (this.deptList.protein && this.deptList.protein < 0 ||
  694. this.deptList.protein && this.deptList.protein > 80) {
  695. this.$api.msg('蛋白输入错误')
  696. return
  697. }
  698. if (this.deptList.protein && this.deptList.protein.indexOf('.') != -1) {
  699. if (this.deptList.protein.split('.')[1].length > 2) {
  700. this.$api.msg('蛋白输入错误')
  701. return
  702. }
  703. }
  704. }
  705. this.insertProcurementPlanInfo = this.deptList
  706. if (this.deptList.salePlanType == '期货') {
  707. this.insertProcurementPlanInfo.basisPrice = this.insertProcurementPlanInfo.basisPrice
  708. }
  709. if (this.imglist.length > 0) {
  710. this.insertProcurementPlanInfo.addressUrl = this.imglist.toString()
  711. }
  712. this.insertProcurementPlanInfo.commonId = this.userInfo.id
  713. this.insertProcurementPlanInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  714. uni.showModal({
  715. content: '重新发布后交易信息将进入待审核状态,是否确定重新发布?',
  716. success: (res) => {
  717. if (res.confirm) {
  718. var that = this
  719. this.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  720. phone: this.deptList.sellerPhone,
  721. verifyCode: this.verifyCode
  722. }).then(res => {
  723. if (res.data.code == 200) {
  724. that.$api.doRequest('post', '/salePlanInfo/api/editSalePlanInfo',
  725. that
  726. .insertProcurementPlanInfo).then(res => {
  727. if (res.data.code == 200) {
  728. // uni.showToast({
  729. // title: "发布成功",
  730. // icon: 'none',
  731. // })
  732. that.$api.msg('重新发布成功')
  733. that.deptList = {}
  734. uni.navigateTo({
  735. url: `/pages/release/release`
  736. })
  737. } else {
  738. uni.showToast({
  739. title: res.data.message,
  740. icon: 'none',
  741. duration: 2000
  742. })
  743. }
  744. })
  745. .catch(res => {
  746. if (res.errmsg) {
  747. uni.showToast({
  748. title: res.errmsg,
  749. icon: 'none',
  750. duration: 2000
  751. })
  752. } else {
  753. uni.showToast({
  754. title: "系统异常,请联系管理员",
  755. icon: 'none',
  756. duration: 2000
  757. })
  758. }
  759. });
  760. } else if (res.data.code == '11003') {
  761. uni.showModal({
  762. title: '提示',
  763. content: '验证码不正确',
  764. });
  765. } else {
  766. uni.showToast({
  767. title: res.data.message,
  768. icon: 'none',
  769. duration: 2000
  770. })
  771. return
  772. }
  773. })
  774. .catch(res => {
  775. uni.showToast({
  776. title: res.data.message,
  777. icon: 'none',
  778. duration: 2000
  779. })
  780. return
  781. });
  782. }
  783. }
  784. })
  785. // this.$api.doRequest('post', '/salePlanInfo/api/editSalePlanInfo', this
  786. // .insertProcurementPlanInfo).then(res => {
  787. // if (res.data.code == 200) {
  788. // uni.showToast({
  789. // title: "发布成功",
  790. // icon: 'none',
  791. // })
  792. // // setTimeout(() => {
  793. // // uni.navigateBack({})
  794. // // }, 1000)
  795. // this.deptList = {}
  796. // uni.navigateTo({
  797. // url: `/pages/release/release`
  798. // })
  799. // } else {
  800. // uni.showToast({
  801. // title: res.data.message,
  802. // icon: 'none',
  803. // duration: 2000
  804. // })
  805. // }
  806. // })
  807. // .catch(res => {
  808. // uni.showToast({
  809. // title: res.errmsg,
  810. // icon: 'none',
  811. // duration: 2000
  812. // })
  813. // });
  814. },
  815. liChange(e) {
  816. this.liIndex = e.detail.value
  817. this.litypes = this.liType[this.liIndex];
  818. this.deptList.grainKey = e.detail.value
  819. this.deptList.grain = this.liType[this.liIndex]
  820. },
  821. pinChange(e) {
  822. this.pinIndex = e.detail.value
  823. this.pintypes = this.pinType[this.pinIndex];
  824. this.deptList.gradeKey = e.detail.value
  825. this.deptList.grade = this.pinType[this.pinIndex]
  826. },
  827. nianChange(e) {
  828. this.nianIndex = e.detail.value
  829. this.niantypes = this.nianType[this.nianIndex];
  830. this.deptList.outputYear = this.nianType[this.nianIndex]
  831. },
  832. baoChange(e) {
  833. this.baoIndex = e.detail.value
  834. this.baotypes = this.baoType[this.baoIndex];
  835. this.deptList.packingTypeKey = e.detail.value
  836. this.deptList.packingType = this.baoType[this.baoIndex];
  837. },
  838. chengChange(e) {
  839. this.chengIndex = e.detail.value
  840. this.chengtypes = this.chengType[this.chengIndex];
  841. this.deptList.freightPayerKey = e.detail.value + 1
  842. this.deptList.freightPayer = this.chengType[this.chengIndex];
  843. }
  844. }
  845. }
  846. </script>
  847. <style>
  848. .center {
  849. padding: 10px 20px;
  850. background-color: #F5F6FA;
  851. }
  852. .c-row {
  853. display: -webkit-box;
  854. display: -webkit-flex;
  855. display: flex;
  856. -webkit-box-align: center;
  857. -webkit-align-items: center;
  858. align-items: center;
  859. padding: 20rpx 30rpx;
  860. position: relative;
  861. }
  862. .con-list {
  863. -webkit-box-flex: 1;
  864. -webkit-flex: 1;
  865. flex: 1;
  866. display: -webkit-box;
  867. display: -webkit-flex;
  868. display: flex;
  869. -webkit-box-orient: vertical;
  870. -webkit-box-direction: normal;
  871. -webkit-flex-direction: column;
  872. flex-direction: column;
  873. line-height: 40rpx;
  874. text-align: right;
  875. padding-right: 20rpx;
  876. font-size: 14px;
  877. }
  878. .con-list input {
  879. font-size: 14px !important;
  880. }
  881. .buyup {
  882. background-color: #FFFFFF;
  883. border-radius: 20px;
  884. margin-top: 10px;
  885. }
  886. .buylow {
  887. background-color: #FFFFFF;
  888. border-radius: 20px;
  889. margin-top: 10px;
  890. }
  891. .remark {
  892. background-color: #FFFFFF;
  893. border-radius: 20px;
  894. margin-top: 10px;
  895. }
  896. .btn {
  897. border-radius: 20px;
  898. margin-top: 10px;
  899. background-color: #22C572;
  900. color: #FFFFFF;
  901. }
  902. .validate {
  903. width: 100px;
  904. height: 32px;
  905. background-color: #F5F6F9;
  906. color: #AFB3BF;
  907. border-radius: 10px;
  908. border: none;
  909. text-align: center;
  910. line-height: 30px;
  911. }
  912. .getcode {
  913. font-size: 14px;
  914. color: #AFB3BF;
  915. background: #F5F6F9;
  916. height: 30px;
  917. line-height: 30px;
  918. }
  919. .no-boder {
  920. border: 0;
  921. }
  922. .wrap {
  923. padding-top: 5px;
  924. font-size: 14px;
  925. background: #fff;
  926. margin: 10px;
  927. border-radius: 10px;
  928. input {
  929. font-size: 14px;
  930. }
  931. }
  932. .textarea {
  933. background: #F9F9FA;
  934. border: 1px solid #EEEEEE;
  935. }
  936. .getcode.active {
  937. background: #22C572;
  938. color: #fff;
  939. }
  940. .fujian{
  941. flex: 1;
  942. display: flex;
  943. flex-direction: column;
  944. color: $font-color-dark;
  945. line-height: 40upx;
  946. text-align: right;
  947. padding-right: 20upx;
  948. }
  949. .swiper .dots {
  950. position: absolute;
  951. bottom: 53px;
  952. background: rgba(255, 255, 255, 0.4);
  953. border-radius: 0px 11px 11px 0px;
  954. width: 58.5px;
  955. height: 23px;
  956. line-height: 23px;
  957. text-align: center;
  958. padding: 3px;
  959. color: #FFFFFF;
  960. }
  961. .delete_img {
  962. position: absolute;
  963. z-index: 100;
  964. left: 84px;
  965. color: #ffffff;
  966. font-size: 28rpx;
  967. border: 1px;
  968. border-radius: 5rpx;
  969. width: 32rpx;
  970. height: 32rpx;
  971. background-color: #ff0000;
  972. text-align: center;
  973. }
  974. .delete_img {
  975. position: absolute;
  976. z-index: 100;
  977. left: 84px;
  978. color: #ffffff;
  979. font-size: 28rpx;
  980. border: 1px;
  981. border-radius: 5rpx;
  982. width: 32rpx;
  983. height: 32rpx;
  984. background-color: #ff0000;
  985. text-align: center;
  986. }
  987. .tubiao {
  988. margin: 0 auto;
  989. text-align: center;
  990. margin-top: 35rpx;
  991. }
  992. .biankuang {
  993. border: 1px dashed #AFB3BF;
  994. border-radius: 10rpx;
  995. width: 200rpx;
  996. height: 200rpx;
  997. margin-left: 20rpx;
  998. }
  999. .upload {
  1000. width: 80rpx;
  1001. height: 80rpx;
  1002. }
  1003. </style>