eadit.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  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 class="linexx">*</span> <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">
  118. <view class="musicMS">选择/更换音乐</view>
  119. <img src="../../static/img/jt.png" alt="" class="musicJt">
  120. </view>
  121. </view>
  122. <view class="musicBox">
  123. <view class="musicLine" v-for="(item,index) in 3">
  124. <view class="musicLineLeft">
  125. <img src="../../static/img/music.png" alt="" class="musicImg">
  126. <view class="musicName">Young For You - GALA.mp3</view>
  127. </view>
  128. <view>
  129. <img src="../../static/img/sanchu.png" alt="" class="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. }
  162. },
  163. onLoad(opt) {
  164. this.img=opt.img
  165. },
  166. onShow() {
  167. const shopckList = uni.getStorageSync("shopckList");
  168. var shopNames=[];
  169. var shopList=[];
  170. shopckList.forEach(item=>{
  171. shopNames.push(item.shopName)
  172. shopList.push(item.id)
  173. })
  174. this.shopNames=shopNames.join(',')
  175. this.shopList=shopList.join(',')
  176. },
  177. methods: {
  178. preview(){
  179. var editdata={
  180. id:this.id,
  181. activityName:this.activityName,
  182. startTime:this.startTime,
  183. endTime:this.endTime,
  184. number:this.number,
  185. activityContent:this.activityContent,
  186. clWhere:this.clWhereString,
  187. payType:this.payType,
  188. music:this.music,
  189. money:this.money,
  190. shopList:this.shopList,
  191. img:this.img,
  192. imgList:this.imgListArr.join(','),
  193. clState:'',
  194. }
  195. console.log(editdata)
  196. uni.setStorage({
  197. key: 'editdata',
  198. data: editdata,
  199. success: function () {
  200. uni.navigateTo({
  201. url:'jkDetail?type=1'
  202. })
  203. }
  204. });
  205. },
  206. addShop(){
  207. uni.navigateTo({
  208. url:'ckshop'
  209. })
  210. },
  211. bindTimeChangeStart(e){
  212. console.log(e)
  213. this.startTime=e.detail.value;
  214. },
  215. bindTimeChangeendTime(e){
  216. this.endTime=e.detail.value;
  217. },
  218. clWhere(num){
  219. this.clWhereString=this.clWhereList.join(',');
  220. if(this.clWhereString.indexOf(num)!=-1){
  221. // this.clWhereList.remove(num)
  222. let index = this.clWhereList.indexOf(num);
  223. this.clWhereList.splice(index, 1)
  224. //this.remove(num)
  225. }else{
  226. this.clWhereList.push(num)
  227. }
  228. this.clWhereString=this.clWhereList.join(',');
  229. console.log(this.clWhereString)
  230. },
  231. delimg(index){
  232. this.imgListArr.splice(index, 1)
  233. },
  234. upimg(){
  235. var that = this;
  236. uni.chooseImage({
  237. sourceType: ['album','camera'],
  238. count:9,
  239. success: (chooseImageRes) => {
  240. const tempFilePaths = chooseImageRes.tempFilePaths;
  241. that.file=tempFilePaths[0]
  242. uni.uploadFile({
  243. url: that.$request.baseUrl+'accompany/SuperCheckSheet/uploadFile', //仅为示例,非真实的接口地址
  244. filePath: tempFilePaths[0],
  245. name: 'file',
  246. formData: {
  247. 'user': 'test'
  248. },
  249. success: (uploadFileRes) => {
  250. console.log(JSON.parse(uploadFileRes.data).data );
  251. that.imgListArr=that.imgListArr.concat(JSON.parse(uploadFileRes.data).data)
  252. //that.imgArr=that.imgArr.concat(JSON.parse(uploadFileRes.data).data) ;
  253. //that.imgurl=JSON.parse(uploadFileRes.data).data[0];
  254. //that.goAddzdy(that.imgurl)
  255. }
  256. });
  257. }
  258. });
  259. }
  260. }
  261. }
  262. </script>
  263. <style scoped>
  264. .content{
  265. min-height: 100vh;
  266. background:#F4F5F7;
  267. }
  268. .preview{
  269. width: 750rpx;
  270. height: 98rpx;
  271. background: #3F90F7;
  272. line-height: 98rpx;
  273. text-align: center;
  274. color: #ffffff;
  275. font-size: 30rpx;
  276. position: fixed;
  277. left: 0;
  278. bottom: 0;
  279. }
  280. .musicBox{
  281. padding: 0 24rpx;
  282. }
  283. .musicLine{
  284. display: flex;
  285. justify-content: space-between;
  286. margin-bottom:30rpx;
  287. padding:26rpx 24rpx;
  288. background: #F4F5F7;
  289. border-radius: 10rpx;
  290. }
  291. .musicName{
  292. color: #3C3C3C;font-size: 24rpx;
  293. }
  294. .musicLineLeft{
  295. display: flex;
  296. }
  297. .musicDel{
  298. width: 30rpx;
  299. height: 30rpx;
  300. }
  301. .musicImg{
  302. width: 36rpx;
  303. height: 36rpx;
  304. }
  305. .line2{
  306. padding: 30rpx 24rpx;
  307. border-bottom: 1px solid #EEEEEE;
  308. }
  309. .musicJt{
  310. width: 28rpx;
  311. height: 28rpx;
  312. margin-top: 8rpx;
  313. }
  314. .musicRight{
  315. display: flex;
  316. justify-content: space-between;
  317. width: 500rpx;
  318. }
  319. .musicMS{
  320. color: #CCCCCC;
  321. }
  322. .lineimgdel{
  323. width: 37rpx;
  324. height: 37rpx;
  325. position: absolute;
  326. top: -18rpx;
  327. right: -18rpx;
  328. }
  329. .lineimghz{
  330. margin-right: 24rpx;
  331. position: relative;
  332. margin-top: 24rpx;
  333. }
  334. .lineimg{
  335. width: 150rpx;
  336. height: 150rpx;
  337. }
  338. .lineTitle{
  339. color: #666666;font-size: 28rpx;
  340. }
  341. .lineMS{
  342. color: #999999;font-size: 24rpx;padding-top: 10rpx;
  343. }
  344. .lineImgBOx{
  345. display: flex;
  346. flex-wrap: wrap;
  347. }
  348. .payBox{
  349. display: flex;
  350. }
  351. .payTypeImg{
  352. width: 36rpx;
  353. height: 36rpx;
  354. }
  355. .payType{
  356. display: flex;
  357. line-height: 36rpx;
  358. }
  359. .payTypeTxt{
  360. padding-left: 10rpx;
  361. color: #3C3C3C;
  362. }
  363. .line{
  364. display: flex;
  365. font-size: 28rpx;
  366. padding: 30rpx 24rpx;
  367. border-bottom: 1px solid #EEEEEE;
  368. }
  369. .linexx{
  370. color: #FF3B30;
  371. }
  372. .dateView{
  373. color:#3C3C3C ;
  374. }
  375. .lineLeft{
  376. width: 200rpx;
  377. color: #666666;
  378. }
  379. .clWhereBox{
  380. display: flex;
  381. }
  382. .clWhereLine{
  383. width: 100rpx;
  384. height: 52rpx;
  385. background: #F4F5F7;
  386. border-radius: 10rpx;
  387. text-align: center;
  388. color: #3C3C3C;
  389. line-height: 52rpx;
  390. font-size: 24rpx;
  391. margin-right: 24rpx;
  392. }
  393. .clWhereBox .clWhereActive{
  394. background: #EAF3FF;
  395. border: 2rpx solid #3F90F7;
  396. height: 48rpx;
  397. color: #3F90F7;
  398. height: 48rpx;
  399. line-height: 48rpx;
  400. width: 96rpx;
  401. }
  402. .timelineRight{
  403. display: flex;
  404. }
  405. .textsr{
  406. width: 500rpx;
  407. height: 180rpx;
  408. }
  409. .shopListNo{
  410. width: 400rpx;
  411. white-space:nowrap;
  412. overflow:hidden;
  413. text-overflow:ellipsis;
  414. color: #CCCCCC;
  415. }
  416. .shopListY{
  417. width: 400rpx;
  418. white-space:nowrap;
  419. overflow:hidden;
  420. text-overflow:ellipsis;
  421. color: #3C3C3C;
  422. }
  423. .addshop{
  424. color: #3F90F7;
  425. padding-left: 10rpx;
  426. }
  427. .shopckBox{
  428. display: flex;
  429. }
  430. .timeHx{
  431. color: #CCCCCC;
  432. padding: 0 30rpx;
  433. }
  434. .lineRightInput{
  435. font-size: 28rpx;
  436. color:#3C3C3C ;
  437. }
  438. .lineRight{
  439. color:#3C3C3C ;
  440. }
  441. .inputPlace{
  442. color: #CCCCCC;
  443. }
  444. .dateViewno{
  445. color: #CCCCCC;
  446. }
  447. .box{
  448. background: #ffffff;
  449. }
  450. .kk{
  451. background:#F4F5F7;
  452. height: 20rpx;
  453. }
  454. .title{
  455. padding-left: 24rpx;
  456. padding-top: 30rpx;
  457. color: #333333;
  458. font-size: 32rpx;
  459. line-height: 45rpx;
  460. font-weight: 500;
  461. }
  462. .lineBorderNo{
  463. border-bottom: none !important;
  464. }
  465. </style>