eadit.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. <template>
  2. <view class="content">
  3. <view class="kk"></view>
  4. <view class="box">
  5. <view class="title">基础信息</view>
  6. <view class="line">
  7. <view class="lineLeft">
  8. <span class="linexx">*</span> <span>活动名称</span>
  9. </view>
  10. <view class="lineRight">
  11. <input type="text" v-model="activityName" placeholder="请输入" class="lineRightInput" placeholder-class="inputPlace">
  12. </view>
  13. </view>
  14. <view class="line">
  15. <view class="lineLeft">
  16. <span class="linexx">*</span> <span>报名时间</span>
  17. </view>
  18. <view class="lineRight timelineRight">
  19. <picker mode="date" :value="startTime" @change="bindTimeChangeStart">
  20. <view class="dateViewno" v-if="!startTime">开始时间</view>
  21. <view class="dateView" v-else>{{startTime}}</view>
  22. </picker>
  23. <view class="timeHx">-</view>
  24. <picker mode="date" :value="endTime" @change="bindTimeChangeendTime">
  25. <view class="dateViewno" v-if="!endTime">结束时间</view>
  26. <view class="dateView" v-else>{{endTime}}</view>
  27. </picker>
  28. </view>
  29. </view>
  30. <view class="line">
  31. <view class="lineLeft">
  32. <span class="linexx">*</span> <span>活动门店</span>
  33. </view>
  34. <view class="lineRight shopckBox">
  35. <view class="shopListNo" v-if="!shopNames">请选择活动门店,可多选请</view>
  36. <view class="shopListY" v-if="shopNames">{{shopNames}}</view>
  37. <view class="addshop" @click="addShop">添加</view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="kk"></view>
  42. <view class="box">
  43. <view class="title">报名信息</view>
  44. <view class="line">
  45. <view class="lineLeft">
  46. <span class="linexx">*</span> <span>报名凭证</span>
  47. </view>
  48. <view class="lineRight clWhereBox">
  49. <view class="clWhereLine" :class="{clWhereActive:clWhereString.indexOf(1)!=-1}" @click="clWhere(1)">手机号</view>
  50. <view class="clWhereLine" :class="{clWhereActive:clWhereString.indexOf(2)!=-1}" @click="clWhere(2)">车牌号</view>
  51. <view class="clWhereLine" :class="{clWhereActive:clWhereString.indexOf(3)!=-1}" @click="clWhere(3)">姓名</view>
  52. <view class="clWhereLine" :class="{clWhereActive:clWhereString.indexOf(4)!=-1}" @click="clWhere(4)">单位</view>
  53. </view>
  54. </view>
  55. <view class="line">
  56. <view class="lineLeft">
  57. <span class="linexx">*</span> <span>最多报名人数</span>
  58. </view>
  59. <view class="lineRight">
  60. <input type="text" v-model="number" placeholder="请输入" class="lineRightInput" placeholder-class="inputPlace">
  61. </view>
  62. </view>
  63. <view class="line">
  64. <view class="lineLeft">
  65. <span class="linexx">*</span> <span>支付方式</span>
  66. </view>
  67. <view class="lineRight payBox">
  68. <view class="payType" @click="payType=1">
  69. <img src="../../static/img/ckn.png" alt="" class="payTypeImg" v-if="payType!=1">
  70. <img src="../../static/img/cky.png" alt="" class="payTypeImg" v-if="payType==1">
  71. <view class="payTypeTxt">在线支付</view>
  72. </view>
  73. <view class="payType" @click="payType=2" style="padding-left: 30rpx;">
  74. <img src="../../static/img/cky.png" alt="" class="payTypeImg" v-if="payType==2">
  75. <img src="../../static/img/ckn.png" alt="" class="payTypeImg" v-if="payType!=2">
  76. <view class="payTypeTxt">无需支付</view>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="line">
  81. <view class="lineLeft">
  82. <span class="linexx">*</span> <span>支付金额</span>
  83. </view>
  84. <view class="lineRight">
  85. <input type="text" v-model="money" placeholder="请输入" class="lineRightInput" placeholder-class="inputPlace">
  86. </view>
  87. </view>
  88. </view>
  89. <view class="kk"></view>
  90. <view class="box">
  91. <view class="title">活动详情</view>
  92. <view class="line">
  93. <view class="lineLeft">
  94. <span>活动说明</span>
  95. </view>
  96. <view class="lineRight">
  97. <textarea placeholder-class="inputPlace" v-model="activityContent" placeholder="请输入" class="textsr"/>
  98. </view>
  99. </view>
  100. <view class="line2">
  101. <view class="lineTitle">详情图片</view>
  102. <view class="lineMS">此图在活动底部显示,可用于显示门店照片等,建议宽度750px</view>
  103. <view class="lineImgBOx">
  104. <view class="lineimghz" v-for="(item,index) in imgListArr">
  105. <img src="../../static/img/del.png" alt="" class="lineimgdel" @click="delimg(index)" >
  106. <img :src="item" alt="" class="lineimg">
  107. </view>
  108. <view class="lineimghz" @click="upimg">
  109. <img src="../../static/img/scimg.png" alt="" class="lineimg">
  110. </view>
  111. </view>
  112. </view>
  113. <view class="line lineBorderNo">
  114. <view class="lineLeft">
  115. <span>音乐</span>
  116. </view>
  117. <view class="lineRight musicRight" @click="goMusic">
  118. <view class="musicMS">选择/更换音乐</view>
  119. <img src="../../static/img/jt.png" alt="" class="musicJt">
  120. </view>
  121. </view>
  122. <view class="musicBox" v-if="ckMusic">
  123. <view class="musicLine">
  124. <view class="musicLineLeft">
  125. <img src="../../static/img/music.png" alt="" class="musicImg">
  126. <view class="musicName">{{ckMusic.name}}</view>
  127. </view>
  128. <view>
  129. <img src="../../static/img/sanchu.png" alt="" class="musicDel" @click="musicDel">
  130. </view>
  131. </view>
  132. </view>
  133. </view>
  134. <view style="height: 120rpx;"></view>
  135. <view class="preview" @click="preview">预览</view>
  136. </view>
  137. </template>
  138. <script>
  139. export default {
  140. data() {
  141. return {
  142. id:'', //类型:String 可有字段 备注:新增无编辑有
  143. activityName:'', //类型:String 必有字段 备注:活动名称
  144. startTime:"", //类型:String 必有字段 备注:营业开始时间
  145. endTime:"", //类型:String 必有字段 备注:营业结束时间
  146. number:"", //类型:String 必有字段 备注:报名人数
  147. activityContent:"", //类型:String 必有字段 备注:活动说明
  148. //clWhere:'', //类型:String 必有字段 备注:报名凭证1,2,3,4 1手机号2车牌号3姓名4单位
  149. payType:1, //类型:String 必有字段 备注:1在线支付2无需支付
  150. music:"", //类型:String 必有字段 备注:背景音乐
  151. clState:'', //类型:String 必有字段 备注:1未启用2启用
  152. img:'', //类型:String 必有字段 备注:从首页带进来的图片
  153. imgList:'',//类型:String 必有字段 备注:详情图片多个以逗号分割
  154. datetimerange: '',
  155. shopNames:'',
  156. shopList:'',
  157. clWhereList:[],
  158. clWhereString:'',
  159. imgListArr:[],
  160. money:'',
  161. ckMusic:'',
  162. }
  163. },
  164. onLoad(opt) {
  165. this.img=opt.img
  166. },
  167. onShow() {
  168. const shopckList = uni.getStorageSync("shopckList");
  169. this.ckMusic=uni.getStorageSync("ckmusic")
  170. if(this.ckMusic){
  171. this.music=this.ckMusic.id
  172. }
  173. var shopNames=[];
  174. var shopList=[];
  175. if(shopckList){
  176. shopckList.forEach(item=>{
  177. shopNames.push(item.shopName)
  178. shopList.push(item.id)
  179. })
  180. this.shopNames=shopNames.join(',')
  181. this.shopList=shopList.join(',')
  182. }
  183. },
  184. methods: {
  185. preview(){
  186. if(this.activityName==''){
  187. uni.showToast({
  188. title: '请输入活动名称',
  189. icon:'none',
  190. duration: 2000
  191. });
  192. return false;
  193. }else if(!this.startTime||!this.endTime){
  194. uni.showToast({
  195. title: '请选择报名时间',
  196. icon:'none',
  197. duration: 2000
  198. });
  199. return false;
  200. }else if(this.shopList==''){
  201. uni.showToast({
  202. title: '请选择活动门店',
  203. icon:'none',
  204. duration: 2000
  205. });
  206. return false;
  207. }else if(this.clWhere==''){
  208. uni.showToast({
  209. title: '请选择报名凭证',
  210. icon:'none',
  211. duration: 2000
  212. });
  213. return false;
  214. }else if(this.number==''){
  215. uni.showToast({
  216. title: '请输入最多报名人数',
  217. icon:'none',
  218. duration: 2000
  219. });
  220. return false;
  221. }else if(this.money==''){
  222. uni.showToast({
  223. title: '请输入支付金额',
  224. icon:'none',
  225. duration: 2000
  226. });
  227. return false;
  228. }
  229. var editdata={
  230. id:this.id,
  231. activityName:this.activityName,
  232. startTime:this.startTime,
  233. endTime:this.endTime,
  234. number:this.number,
  235. activityContent:this.activityContent,
  236. clWhere:this.clWhereString,
  237. payType:this.payType,
  238. music:this.music,
  239. money:this.money,
  240. shopList:this.shopList,
  241. img:this.img,
  242. imgList:this.imgListArr.join(','),
  243. clState:'',
  244. }
  245. console.log(editdata)
  246. uni.setStorage({
  247. key: 'editdata',
  248. data: editdata,
  249. success: function () {
  250. uni.navigateTo({
  251. url:'jkDetail?type=1'
  252. })
  253. }
  254. });
  255. },
  256. addShop(){
  257. uni.navigateTo({
  258. url:'ckshop'
  259. })
  260. },
  261. goMusic(){
  262. uni.navigateTo({
  263. url:'ckmusic'
  264. })
  265. },
  266. musicDel(){
  267. this.music='';
  268. this.ckMusic=''
  269. uni.removeStorageSync('ckmusic');
  270. },
  271. bindTimeChangeStart(e){
  272. console.log(e)
  273. this.startTime=e.detail.value;
  274. },
  275. bindTimeChangeendTime(e){
  276. this.endTime=e.detail.value;
  277. },
  278. clWhere(num){
  279. this.clWhereString=this.clWhereList.join(',');
  280. if(this.clWhereString.indexOf(num)!=-1){
  281. // this.clWhereList.remove(num)
  282. let index = this.clWhereList.indexOf(num);
  283. this.clWhereList.splice(index, 1)
  284. //this.remove(num)
  285. }else{
  286. this.clWhereList.push(num)
  287. }
  288. this.clWhereString=this.clWhereList.join(',');
  289. console.log(this.clWhereString)
  290. },
  291. delimg(index){
  292. this.imgListArr.splice(index, 1)
  293. },
  294. upimg(){
  295. var that = this;
  296. uni.chooseImage({
  297. sourceType: ['album','camera'],
  298. count:9,
  299. success: (chooseImageRes) => {
  300. const tempFilePaths = chooseImageRes.tempFilePaths;
  301. that.file=tempFilePaths[0]
  302. uni.uploadFile({
  303. url: that.$request.baseUrl+'accompany/SuperCheckSheet/uploadFile', //仅为示例,非真实的接口地址
  304. filePath: tempFilePaths[0],
  305. name: 'file',
  306. formData: {
  307. 'user': 'test'
  308. },
  309. success: (uploadFileRes) => {
  310. console.log(JSON.parse(uploadFileRes.data).data );
  311. that.imgListArr=that.imgListArr.concat(JSON.parse(uploadFileRes.data).data)
  312. //that.imgArr=that.imgArr.concat(JSON.parse(uploadFileRes.data).data) ;
  313. //that.imgurl=JSON.parse(uploadFileRes.data).data[0];
  314. //that.goAddzdy(that.imgurl)
  315. }
  316. });
  317. }
  318. });
  319. }
  320. }
  321. }
  322. </script>
  323. <style scoped>
  324. .content{
  325. min-height: 100vh;
  326. background:#F4F5F7;
  327. }
  328. .preview{
  329. width: 750rpx;
  330. height: 98rpx;
  331. background: #3F90F7;
  332. line-height: 98rpx;
  333. text-align: center;
  334. color: #ffffff;
  335. font-size: 30rpx;
  336. position: fixed;
  337. left: 0;
  338. bottom: 0;
  339. }
  340. .musicBox{
  341. padding: 0 24rpx;
  342. }
  343. .musicLine{
  344. display: flex;
  345. justify-content: space-between;
  346. margin-bottom:30rpx;
  347. padding:26rpx 24rpx;
  348. background: #F4F5F7;
  349. border-radius: 10rpx;
  350. }
  351. .musicName{
  352. color: #3C3C3C;font-size: 24rpx;
  353. padding-left: 10rpx;
  354. }
  355. .musicLineLeft{
  356. display: flex;
  357. }
  358. .musicDel{
  359. width: 30rpx;
  360. height: 30rpx;
  361. }
  362. .musicImg{
  363. width: 36rpx;
  364. height: 36rpx;
  365. }
  366. .line2{
  367. padding: 30rpx 24rpx;
  368. border-bottom: 1px solid #EEEEEE;
  369. }
  370. .musicJt{
  371. width: 28rpx;
  372. height: 28rpx;
  373. margin-top: 8rpx;
  374. }
  375. .musicRight{
  376. display: flex;
  377. justify-content: space-between;
  378. width: 500rpx;
  379. }
  380. .musicMS{
  381. color: #CCCCCC;
  382. }
  383. .lineimgdel{
  384. width: 37rpx;
  385. height: 37rpx;
  386. position: absolute;
  387. top: -18rpx;
  388. right: -18rpx;
  389. }
  390. .lineimghz{
  391. margin-right: 24rpx;
  392. position: relative;
  393. margin-top: 24rpx;
  394. }
  395. .lineimg{
  396. width: 150rpx;
  397. height: 150rpx;
  398. }
  399. .lineTitle{
  400. color: #666666;font-size: 28rpx;
  401. }
  402. .lineMS{
  403. color: #999999;font-size: 24rpx;padding-top: 10rpx;
  404. }
  405. .lineImgBOx{
  406. display: flex;
  407. flex-wrap: wrap;
  408. }
  409. .payBox{
  410. display: flex;
  411. }
  412. .payTypeImg{
  413. width: 36rpx;
  414. height: 36rpx;
  415. }
  416. .payType{
  417. display: flex;
  418. line-height: 36rpx;
  419. }
  420. .payTypeTxt{
  421. padding-left: 10rpx;
  422. color: #3C3C3C;
  423. }
  424. .line{
  425. display: flex;
  426. font-size: 28rpx;
  427. padding: 30rpx 24rpx;
  428. border-bottom: 1px solid #EEEEEE;
  429. }
  430. .linexx{
  431. color: #FF3B30;
  432. }
  433. .dateView{
  434. color:#3C3C3C ;
  435. }
  436. .lineLeft{
  437. width: 200rpx;
  438. color: #666666;
  439. }
  440. .clWhereBox{
  441. display: flex;
  442. }
  443. .clWhereLine{
  444. width: 100rpx;
  445. height: 52rpx;
  446. background: #F4F5F7;
  447. border-radius: 10rpx;
  448. text-align: center;
  449. color: #3C3C3C;
  450. line-height: 52rpx;
  451. font-size: 24rpx;
  452. margin-right: 24rpx;
  453. }
  454. .clWhereBox .clWhereActive{
  455. background: #EAF3FF;
  456. border: 2rpx solid #3F90F7;
  457. height: 48rpx;
  458. color: #3F90F7;
  459. height: 48rpx;
  460. line-height: 48rpx;
  461. width: 96rpx;
  462. }
  463. .timelineRight{
  464. display: flex;
  465. }
  466. .textsr{
  467. width: 500rpx;
  468. height: 180rpx;
  469. }
  470. .shopListNo{
  471. width: 400rpx;
  472. white-space:nowrap;
  473. overflow:hidden;
  474. text-overflow:ellipsis;
  475. color: #CCCCCC;
  476. }
  477. .shopListY{
  478. width: 400rpx;
  479. white-space:nowrap;
  480. overflow:hidden;
  481. text-overflow:ellipsis;
  482. color: #3C3C3C;
  483. }
  484. .addshop{
  485. color: #3F90F7;
  486. padding-left: 10rpx;
  487. }
  488. .shopckBox{
  489. display: flex;
  490. }
  491. .timeHx{
  492. color: #CCCCCC;
  493. padding: 0 30rpx;
  494. }
  495. .lineRightInput{
  496. font-size: 28rpx;
  497. color:#3C3C3C ;
  498. }
  499. .lineRight{
  500. color:#3C3C3C ;
  501. }
  502. .inputPlace{
  503. color: #CCCCCC;
  504. }
  505. .dateViewno{
  506. color: #CCCCCC;
  507. }
  508. .box{
  509. background: #ffffff;
  510. }
  511. .kk{
  512. background:#F4F5F7;
  513. height: 20rpx;
  514. }
  515. .title{
  516. padding-left: 24rpx;
  517. padding-top: 30rpx;
  518. color: #333333;
  519. font-size: 32rpx;
  520. line-height: 45rpx;
  521. font-weight: 500;
  522. }
  523. .lineBorderNo{
  524. border-bottom: none !important;
  525. }
  526. </style>