form.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. <template name="secondHandrelease">
  2. <view class="fleaMarketForm">
  3. <view class="bannerimg"><image src="https://admin-b.caimei365.com/userfiles/1/images/photo/2020/11/banner3.png"></image></view>
  4. <view class="my-maintenance" >
  5. <view class="newsTitle">
  6. <p>欢迎您来到采美365网二手商品市场,您可以在这里发布二手设备、产品信息,每个商品需要收取您100元的展示费,展示期为6个月;
  7. 为了完整展示您的商品,请您认真填写以下内容,谢谢合作。</p>
  8. </view>
  9. <form>
  10. <view class="row">
  11. <label><span>*</span>分类</label>
  12. <view class="secondradio" >
  13. <view v-for="(item,index) in fenlei" :key="index" v-model="secondParams.secondHandType" @click="secondHandRidio(item)"
  14. :class="currentId==item.value?'select active':''" class="icon">
  15. <label class="icon typeradio"></label>{{item.name}}
  16. </view>
  17. </view>
  18. </view>
  19. </form>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import { mapState,mapMutations } from 'vuex';
  25. export default{
  26. name:'secondHandrelease',
  27. components:{
  28. },
  29. data(){
  30. return{
  31. fenlei:[
  32. {name:'二手仪器',value:'1'},
  33. {name:'临期产品',value:'2'},
  34. {name:'其他',value:'3'},
  35. ],
  36. currentId:0,
  37. radioList:[
  38. {name:'轻光电',value:'1',isChecked:false},
  39. {name:'重光电',value:'2',isChecked:false},
  40. {name:'耗材配件',value:'3',isChecked:false},
  41. ],
  42. beauty:[
  43. {name:'医美',value:'1'},
  44. {name:'非医美',value:'2'},
  45. ],
  46. BrandList:[],
  47. isShow:false,
  48. includedTax:'',
  49. GoodsImagesList:[],
  50. oldNum:0,
  51. secondType:0,
  52. vShow_GoodsImages:false,
  53. fromMessage:'',//提示文字
  54. // formData:new FormData(),
  55. secondParams:{
  56. secondHandType:'',//一级分类
  57. instrumentType:'',//二手仪器分类
  58. name:'',
  59. brandID:'',//品牌ID
  60. brandName:'',//其他品牌
  61. fixedYears:null,//出厂
  62. companyName:'',//公司名称
  63. maturityYears:'',//产品到期
  64. price1:'',//交易价
  65. detailTalkFlag:1,//是否启用详聊
  66. normalPrice:'',//市场价
  67. originalPrice:'',//采购价
  68. stock:'',//数量
  69. productQuality:'',//商品成色
  70. contactName:'',//联系人
  71. contactMobile:'',//联系方式
  72. secondProductType:null,//
  73. townId:'',//县区地址
  74. address:'',//详细地址
  75. image1:'',//图片
  76. productDetails:'',//商品详细信息
  77. source:1,
  78. },
  79. brandname:'请选择',
  80. checkbox:false,
  81. shoplogoTwo:false,
  82. provinceIndex:'',
  83. provinceArray:[],
  84. cityArray: [],//市
  85. townArray: [],//区
  86. from: {
  87. name:'',
  88. province: '',//省id
  89. city: '',
  90. town: ''
  91. },
  92. TypeList:'',
  93. playid:'',
  94. checkVal:[],
  95. vShow_secondBj:false,
  96. resultBj:false,
  97. vShow_detailTalkFlag:false,
  98. vShow_secondHandType:false,
  99. vShow_instrumentType:false,
  100. vShow_BrandID:false,
  101. vShow_Name:false,
  102. vShow_Price:false,
  103. vShow_shopColor:false,
  104. vShow_contactName:false,
  105. vShow_contactMobile:false,
  106. vShow_Address:false,
  107. vShow_TownId:false,
  108. vShow_Market:false,
  109. vShow_original:false,
  110. vShow_Number:false,
  111. vShow_expire:false,
  112. vShow_detailInfoEditor:true,
  113. vShow_GoodsImages:false,
  114. vShow_checkBox:false,
  115. selectBrand:false
  116. }
  117. },
  118. methods:{
  119. showBrand:function(){
  120. var _this = this;
  121. _this.selectBrand = !_this.selectBrand;
  122. },
  123. secondHandRidio: function(item) {
  124. var _this = this;
  125. _this.currentId = item.value;
  126. _this.secondParams.secondHandType = item.value;
  127. if (item.value==1){
  128. _this.isShow = true;
  129. }else {
  130. _this.isShow = false;
  131. }
  132. },
  133. secondHandType:function(item){ //二手仪器
  134. item.isChecked = ! item.isChecked;
  135. var _this = this;
  136. if(item.isChecked){
  137. _this.checkVal.push(item.value);
  138. _this.secondParams.instrumentType = _this.checkVal.toString();
  139. } else {
  140. _this.checkVal.splice(_this.checkVal.indexOf(item.value), 1);
  141. _this.secondParams.instrumentType = _this.checkVal.toString();
  142. }
  143. },
  144. ChangeBrand:function(item){ //品牌列表
  145. var _this = this;
  146. _this.brandname = item.name;
  147. _this.secondParams.brandID = item.id;
  148. if(_this.secondParams.brandID==161){
  149. _this.shoplogoTwo = true;
  150. }else {
  151. _this.shoplogoTwo = false;
  152. }
  153. },
  154. Detailed:function(){
  155. var _this = this;
  156. if(event.target.checked==true){
  157. _this.secondParams.detailTalkFlag = 2 ;//启用价格详聊
  158. _this.vShow_detailTalkFlag = true;
  159. }else {
  160. _this.secondParams.detailTalkFlag = 1 ;//不启用价格详聊
  161. _this.vShow_detailTalkFlag = false;
  162. }
  163. },
  164. dragstart: function(value) { // 记录初始信息
  165. this.oldNum = value;
  166. },
  167. uploadGoodsImagesFn: function(event){//上传商品图片
  168. var _this = this;
  169. var inputDOM = _this.$refs.goodsImages;
  170. var file = inputDOM.files;
  171. _this.formData.append('file', file[0]);
  172. SecondApi.uploadimg(_this.formData,function(response){
  173. _this.GoodsImagesList.push(response.data);
  174. _this.secondParams.image1 =_this.GoodsImagesList.toString()+',';
  175. event.target.value = '';
  176. });
  177. },
  178. removeGoodsImagesFn: function(index){//删除商品图片
  179. var _this = this;
  180. _this.GoodsImagesList.splice(index,1);
  181. _this.secondParams.image1 =_this.GoodsImagesList.toString()+',';
  182. },
  183. getProductType:function(item){
  184. var _this = this;
  185. _this.secondType=item;
  186. _this.secondParams.secondProductType = item ;
  187. },
  188. submitBtn:function () {
  189. var _this = this;
  190. if(_this.secondParams.secondHandType == ''){
  191. _this.vShow_secondHandType = true;
  192. _this.fromMessage = '请选择分类';
  193. _this.scrollIntoView();
  194. setTimeout(function(){
  195. _this.vShow_secondHandType= false;
  196. },2000);
  197. return;
  198. }
  199. if(_this.secondParams.secondHandType == 1 ){
  200. if(_this.secondParams.instrumentType ==''){
  201. _this.vShow_instrumentType = true;
  202. _this.fromMessage = '请完善仪器分类';
  203. _this.scrollIntoView();
  204. setTimeout(function(){
  205. _this.vShow_instrumentType= false;
  206. },2000);
  207. return;
  208. }
  209. }
  210. if(_this.secondParams.brandID == ''){
  211. _this.vShow_BrandID = true;
  212. _this.fromMessage = '请选择商品品牌';
  213. _this.scrollIntoView();
  214. setTimeout(function(){
  215. _this.vShow_BrandID = false;
  216. },2000);
  217. return;
  218. }
  219. if(_this.secondParams.name == ''){
  220. _this.vShow_Name = true;
  221. _this.fromMessage = '请输入商品名称';
  222. _this.scrollIntoView();
  223. setTimeout(function(){
  224. _this.vShow_Name = false;
  225. },2000);
  226. return
  227. }
  228. if(_this.secondParams.secondHandType ==2) {
  229. if (_this.secondParams.normalPrice == '') {
  230. _this.vShow_Market = true;
  231. _this.fromMessage = '请输入市场价';
  232. _this.scrollIntoView();
  233. setTimeout(function () {
  234. _this.vShow_Market = false;
  235. }, 2000);
  236. return
  237. }
  238. if (_this.secondParams.maturityYears == '') {
  239. _this.vShow_expire = true;
  240. _this.fromMessage = '请输入产品到期日';
  241. _this.scrollIntoView();
  242. setTimeout(function () {
  243. _this.vShow_expire = false;
  244. }, 2000);
  245. return
  246. }
  247. }
  248. if(_this.secondParams.price1 == ''){
  249. _this.vShow_Price = true;
  250. _this.fromMessage = '请输入交易价';
  251. _this.scrollIntoView();
  252. setTimeout(function(){
  253. _this.vShow_Price = false;
  254. },2000);
  255. return
  256. }
  257. if(_this.secondParams.secondHandType ==2){
  258. if(_this.secondParams.originalPrice == ''){
  259. _this.vShow_original = true;
  260. _this.fromMessage = '请输入采购价/原价';
  261. _this.scrollIntoView();
  262. setTimeout(function(){
  263. _this.vShow_original = false;
  264. },2000);
  265. return
  266. }
  267. if(_this.secondParams.stock == ''){
  268. _this.vShow_Number = true;
  269. _this.fromMessage = '请输入数量';
  270. _this.scrollIntoView();
  271. setTimeout(function(){
  272. _this.vShow_Number = false;
  273. },2000);
  274. return
  275. }
  276. }
  277. if(_this.secondParams.productQuality == ''){
  278. _this.vShow_shopColor = true;
  279. _this.fromMessage = '请输入商品成色';
  280. _this.scrollIntoView();
  281. setTimeout(function(){
  282. _this.vShow_shopColor = false;
  283. },2000);
  284. return
  285. }
  286. if(_this.secondParams.contactName == ''){
  287. _this.vShow_contactName = true;
  288. _this.fromMessage = '请输入联系人姓名';
  289. _this.scrollIntoView();
  290. setTimeout(function(){
  291. _this.vShow_contactName = false;
  292. },2000);
  293. return
  294. }
  295. if(_this.secondParams.contactMobile == ''){
  296. _this.vShow_contactMobile = true;
  297. _this.fromMessage = '请输入联系方式';
  298. _this.scrollIntoView();
  299. setTimeout(function(){
  300. _this.vShow_contactMobile = false;
  301. },2000);
  302. return
  303. }
  304. if(_this.secondParams.contactMobile.length !=11){
  305. _this.vShow_contactMobile = true;
  306. _this.fromMessage = '联系方式格式不正确';
  307. _this.scrollIntoView();
  308. setTimeout(function(){
  309. _this.vShow_contactMobile = false;
  310. },2000);
  311. return
  312. }
  313. if(_this.secondParams.townId == ''|| _this.secondParams.townId == undefined){
  314. _this.vShow_TownId = true;
  315. _this.fromMessage = '请完善联系地址';
  316. _this.scrollIntoView();
  317. setTimeout(function(){
  318. _this.vShow_TownId = false;
  319. },2000);
  320. return
  321. }
  322. if(_this.secondParams.address == ''){
  323. _this.vShow_Address = true;
  324. _this.fromMessage = '请填写详细地址';
  325. document.getElementById('Address').scrollIntoView({block: 'start', behavior: 'smooth'});
  326. setTimeout(function(){
  327. _this.vShow_Address = false;
  328. },2000);
  329. return
  330. }
  331. if(_this.GoodsImagesList ==''){
  332. _this.vShow_GoodsImages = true;
  333. _this.fromMessage = '请上传图片';
  334. document.documentElement.scrollTop=900;
  335. setTimeout(function(){
  336. _this.vShow_GoodsImages = false;
  337. },2000);
  338. return;
  339. }
  340. if(_this.checkbox==false){
  341. _this.vShow_checkBox = true;
  342. _this.fromMessage='请勾选已阅读';
  343. setTimeout(function(){
  344. _this.vShow_checkBox = false;
  345. },2000);
  346. return
  347. }
  348. console.log(_this.secondParams)
  349. SecondApi.SecondHandProduct(_this.secondParams,function (res) { //提交发布
  350. if (res.code==0){
  351. console.log(res)
  352. _this.vShow_secondBj = true;
  353. _this.playid= res.data;
  354. }else{
  355. this.$util.msg(res.msg,2000)
  356. _this.secondBj = false;
  357. return
  358. }
  359. })
  360. },
  361. quxiao:function(){
  362. var _this = this;
  363. _this.vShow_secondBj = false;
  364. },
  365. gopay:function(){
  366. var _this = this;
  367. window.location.href = '/pay/caimei-paycash.html?pageType=1&&type=confirm&productID='+_this.playid;
  368. _this.vShow_secondBj = false;
  369. },
  370. scrollIntoView: function(){
  371. document.getElementById('secondHandrelease').scrollIntoView({block: 'start', behavior: 'smooth'});
  372. },
  373. province:function () {
  374. var _this = this;
  375. _this.from.province = event.target.value;
  376. if(_this.from.province==''){//省为请选择时市区初始化
  377. _this.cityArray=[];
  378. _this.townArray=[];
  379. _this.secondParams.townId=''
  380. }else {
  381. _this.getcity();
  382. }
  383. },
  384. getcity:function(event){//加载市
  385. var _this = this;
  386. PublicApi.GetCity({ provinceId: _this.from.province },function(response){
  387. if(response.code == 0 ){
  388. _this.cityArray = response.data;
  389. _this.from.city = event.target.value;
  390. if(_this.from.city==''){
  391. _this.townArray=[];
  392. }else {
  393. _this.getcTown();
  394. }
  395. }
  396. })
  397. },
  398. getcTown:function(event){
  399. var _this = this;
  400. PublicApi.GetTown({cityId:_this.from.city},function(response){
  401. if(response.code == 0 ){
  402. _this.townArray = response.data;
  403. _this.secondParams.townId = event.target.value;
  404. }else{
  405. this.$util.msg(response.msg,2000)
  406. }
  407. })
  408. },
  409. changeBox:function () {
  410. if(event.target.checked ==true){
  411. this.checkbox = true
  412. }else {
  413. this.checkbox = false
  414. }
  415. },
  416. },
  417. created:function () {
  418. var _this = this;
  419. _this.SecondService.brandList({},function (res) {//品牌列表
  420. if(res.code == 0){
  421. _this.BrandList = res.data;
  422. }
  423. })
  424. _this.SecondService.GetProvince({},function(response){ //省份
  425. if(response.code == 0){
  426. _this.provinceArray = response.data
  427. }else{
  428. this.$util.msg(response.msg,2000)
  429. }
  430. })
  431. },
  432. }
  433. </script>
  434. <style>
  435. view{font-size: 28rpx;}
  436. .my-maintenance{padding: 20rpx;}
  437. .bannerimg {height: 66rpx;width: 100%;}
  438. .bannerimg image{width: 100%;height: 100% ;}
  439. .newsTitle {line-height: 48rpx;text-align: left;color: #e15616;padding:20rpx;background-color: rgba(225, 86, 22, .1);font-size: 28rpx;}
  440. .secondradio view{display: inline-block;color: #333333;}
  441. .typeradio.icon::before{
  442. .secondradio{margin-bottom:20rpx}
  443. }
  444. </style>