seat.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810
  1. <template name="dever-seat">
  2. <view class="w-100 grace-body">
  3. <view class="bg-f1">
  4. <movable-area :style="'height:'+(seatRow*40+350)+'rpx;width: 100vw;tops:'+(rpxNum*132)+'px'" class="pt-f left-0">
  5. <movable-view :style="'width: 100vw;height:'+(seatRow*40+350)+'rpx;'" :inertia="true" :scale="true" :scale-min="0.95"
  6. :scale-max="2" direction="all" @change="onMove" @scale="onScale">
  7. <picker @change="openHall" :value="hall_index" :range="hall_data" v-if="hall_state">
  8. <view class="Stage dp-f jc-c ai-c fz-22 color-333" style="margin-top:10rpx">
  9. {{hall_data[hall_index]}}
  10. </view>
  11. </picker>
  12. <view style="height: 30rpx;margin-top: 30rpx;margin-bottom: 30rpx;" class="m-0-a mt-48 dp-f jc-c ai-c fz-22 color-999 br-5">{{item.name}}</view>
  13. <view v-for="(item,index) in seatArray" :key="index" class="dp-f jc-c mt-20" :style="'width:'+boxWidth+'px;height:'+seatSize+'px'">
  14. <view v-for="(seat,col) in item" :key="col" class="dp-ib" :style="'width:'+seatSize+'px;height:'+seatSize+'px'"
  15. @click="handleChooseSeat(index,col)">
  16. <image v-if="seat.type===0" class="w-100 h-100" src="@/static/seat/unselected.png" mode="aspectFit"></image>
  17. <image v-else-if="seat.type===1" class="w-100 h-100" src="@/static/seat/selected.png" mode="aspectFit" style="width:40rpx;height:40rpx;"></image>
  18. <image v-else-if="seat.type===2" class="w-100 h-100" :id="seat.TipsId" src="@/static/seat/bought.png" mode="aspectFit" style="width:40rpx;height:40rpx;" :src="seat.User.avatar" @click="showTips(seat.TipsId, seat.Id, seat.Tips, seat.SeatCode, seat.User)"></image>
  19. </view>
  20. </view>
  21. <view class="pt-f bg-line br-15 over-h" :style="'left: '+(10-moveX/scale)+'px;top:112rpx;width:30rpx;'">
  22. <view class="w-100 dp-f ai-c jc-c fz-22 color-fff" :style="'height:'+seatSize+'px;margin-top:20rpx;'" v-for="(m,mindex) in mArr"
  23. :key="mindex">{{m}}</view>
  24. <view :style="'height: 20rpx;'"></view>
  25. </view>
  26. </movable-view>
  27. </movable-area>
  28. <view class="pt-f bottom-bar left-0 dp-f fd-cr z1000">
  29. <view class="bg-white p-all-32" style="width: 750rpx;">
  30. <view class="dp-f ai-c jc-c fz-28 color-333 mb-20" v-if="SelectNum===0">
  31. 推荐选座
  32. <view style="width: 106rpx;height: 60rpx;" class="b-1 br-5 dp-f ai-c jc-c fz-28 ml-20" v-for="(n,numindex) in 4"
  33. :key="n" @click="smartChoose(numindex+1)">
  34. {{numindex+1}}
  35. </view>
  36. </view>
  37. <view class="dp-f ai-c fw-w fz-28 color-333 mb-20" v-if="SelectNum>0">
  38. <text>已选</text>
  39. <view class="p-all-10 b-1 br-5 dp-f ai-c jc-c fz-28 ml-20" v-for="(optItem,optindex) in optArr" :key="optindex">
  40. {{optItem.RowNum+'排'+optItem.ColumnNum+'座'}}
  41. </view>
  42. </view>
  43. <view style="width: 566rpx;height: 90rpx;" class="dp-f jc-c ai-c br-10 fz-34 color-fff" :class="SelectNum>0?'bg-red-1':'bg-unbtn'"
  44. @click="buySeat">
  45. <text>{{SelectNum>0?('¥ '+aPrice+' 确认座位'):'选择座位后才能观看'}}</text>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <view v-if="show">
  51. <dever-publish :title="title" :is_upload="false" @hideModal="hideTips" @getRefresh="getRefresh" :type="seat_table" :type_id="seat_table_id" :api="api" :playtime="playtime"></dever-publish>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. import deverPublish from '@/lib/dever/components/publish.vue';
  57. export default {
  58. props: {
  59. type : {
  60. type : String,
  61. value : null
  62. },
  63. type_id : {
  64. type : String,
  65. value : null
  66. },
  67. item : {
  68. type : Object,
  69. value : null
  70. },
  71. index : 0
  72. },
  73. components:{
  74. deverPublish
  75. },
  76. data() {
  77. return {
  78. cycle : false,
  79. scaleMin:1,//h5端为解决1无法缩小问题,设为0.95
  80. boxWidth: 400, //屏幕宽度px
  81. space: ' ', //空格
  82. seatArray: [], //影院座位的二维数组,-1为非座位,0为未购座位,1为已选座位(绿色),2为已购座位(红色),一维行,二维列
  83. seatRow: 0, //影院座位行数
  84. seatCol: 0, //影院座位列数
  85. seatSize: 0, //座位尺寸
  86. SelectNum: 0, //选择座位数
  87. moveX: 0, //水平移动偏移量
  88. scale: 1, //放大倍数
  89. minRow: 0, //从第几行开始排座位
  90. minCol: 0, //从第几列开始排座位
  91. showTis: true, //显示选座提示
  92. seatList: [], //接口获取的原始位置
  93. mArr: [], //排数提示
  94. optArr: [], //选中的座位数组。
  95. isWXAPP:false,
  96. price : 1,
  97. fetch : {
  98. user : {},
  99. hall : 1,
  100. disabled : true,
  101. },
  102. show : false,
  103. api : 'app/community/?l=api.addTips',
  104. title : '发布聊天泡泡',
  105. seat_table : '',
  106. seat_table_id : 0,
  107. tipsData : {},
  108. page : 1,
  109. play : false,
  110. playtime : 0,
  111. tipsTimeData : {},
  112. hall_state : false,
  113. hall_data : [],
  114. hall_index : 0,
  115. //手动停止播放
  116. setStop : false,
  117. };
  118. },
  119. computed: {
  120. aPrice() {
  121. return (this.SelectNum - 1) * this.price
  122. },
  123. rpxNum() {
  124. return this.boxWidth / 750
  125. },
  126. pxNum() {
  127. return 750 / this.boxWidth
  128. },
  129. },
  130. mounted() {
  131. if (this.item.title) {
  132. this.title = this.item.title;
  133. }
  134. this.price = parseFloat(this.item.seat_price);
  135. this.setHall();
  136. //获取宽度
  137. uni.getSystemInfo({
  138. success: function(e) {
  139. this.boxWidth = e.screenWidth
  140. //#ifdef H5
  141. this.scaleMin = 0.95
  142. //#endif
  143. }
  144. })
  145. this.page = 1;
  146. this.initData(this.hall)
  147. },
  148. methods: {
  149. setHall : function() {
  150. var default_hall = this.Dever.data('hall_' + this.item.id);
  151. if (!default_hall) {
  152. default_hall = 1;
  153. } else {
  154. default_hall = parseInt(default_hall);
  155. }
  156. var hall = parseInt(this.item.hall_num);
  157. this.hall_index = default_hall - 1;
  158. this.hall = default_hall;
  159. var hall_state = false;
  160. for (var i=0; i<hall ; i++) {
  161. this.hall_data[i] = (i+1) + '号厅';
  162. if (this.hall_index == i) {
  163. hall_state = true;
  164. }
  165. }
  166. if (!hall_state) {
  167. this.hall_index = 0;
  168. this.hall = 1;
  169. }
  170. this.hall_state = true;
  171. },
  172. openHall : function(e) {
  173. this.hall_index = e.detail.value;
  174. this.hall = parseInt(this.hall_index+1);
  175. this.Dever.data('hall_' + this.item.id, this.hall);
  176. this.page = 1;
  177. this.initData(this.hall);
  178. },
  179. showTips : function(tipsid, id, tips, code, user) {
  180. if (!this.play && this.playtime == 0) {
  181. this.Dever.alert('播放时才能发送消息');
  182. return;
  183. }
  184. this.seat_table = tips;
  185. this.seat_table_id = id;
  186. this.show = true;
  187. if (this.play) {
  188. this.setStop = true;
  189. this.$emit('stop');
  190. }
  191. },
  192. hideTips : function() {
  193. this.show = false;
  194. if (this.setStop == true) {
  195. this.$emit('start');
  196. this.setStop = false;
  197. }
  198. },
  199. setDisabled : function() {
  200. this.$emit('setDisabled', this.fetch.disabled);
  201. },
  202. tips : function(id, content) {
  203. var id = '#tips_' + this.type_id + '_' + id;
  204. if (this.tipsData[id]) {
  205. this.Dever.layer.close(this.tipsData[id]);
  206. }
  207. this.tipsData[id] = this.Dever.layer.tips(content, id, {
  208. tips: [1, '#0FA6D8'],
  209. tipsMore: true
  210. });
  211. },
  212. getRefresh : function(cate_id, type, type_id, content) {
  213. this.tips(type_id, content);
  214. if (!this.tipsTimeData[this.playtime]) {
  215. this.tipsTimeData[this.playtime] = [];
  216. }
  217. this.tipsTimeData[this.playtime].push({type_id:type_id,content:content});
  218. this.hideTips();
  219. },
  220. initData: function(hall) {
  221. var self = this;
  222. this.cycle && (clearInterval(this.cycle));
  223. this.Dever.get(this, 'app/user/?l=api.seat', {code:this.Dever.config.code,noloading:1, content_id : this.type_id, hall : hall}, function(t) {
  224. self.setDisabled();
  225. let arr = t.seat
  226. //数据说明:SeatCode座位编号,RowNum-行号,ColumnNum-纵号,YCoord-Y坐标,XCoord-X坐标,Status-状态
  227. let row = 0
  228. let col = 0
  229. let minCol = parseInt(arr[0].XCoord)
  230. let minRow = parseInt(arr[0].YCoord)
  231. for (let i of arr) {
  232. minRow = parseInt(i.YCoord) < minRow ? parseInt(i.YCoord) : minRow
  233. minCol = parseInt(i.XCoord) < minCol ? parseInt(i.XCoord) : minCol
  234. row = parseInt(i.YCoord) > row ? parseInt(i.YCoord) : row
  235. col = parseInt(i.XCoord) > col ? parseInt(i.XCoord) : col
  236. self.seat_table = i.Tips
  237. }
  238. self.seatList = arr
  239. self.seatRow = row - minRow + 1
  240. self.seatCol = col - minCol + 3
  241. self.minRow = minRow
  242. self.minCol = minCol - 1
  243. self.initSeatArray()
  244. self.tipsTimeData = {};
  245. self.getData();
  246. });
  247. },
  248. start : function() {
  249. this.play = true;
  250. },
  251. stop : function() {
  252. this.play = false;
  253. this.Dever.layer.closeAll();
  254. },
  255. time : function(time) {
  256. this.playtime = time;
  257. //console.info(time);
  258. if (this.tipsTimeData[time]) {
  259. this.handle(this.tipsTimeData[time]);
  260. }
  261. },
  262. // 获取聊天历史数据
  263. getData : function() {
  264. var self = this;
  265. this.Dever.get(this, 'app/community/?l=api.tips', {code:this.Dever.config.code,noloading:1, type:this.seat_table, pg:this.page}, function(t) {
  266. var arr = Object.keys(t.info);
  267. if (arr.length > 0) {
  268. self.save(t.info);
  269. }
  270. });
  271. },
  272. save : function(data) {
  273. this.tipsTimeData = Object.assign(this.tipsTimeData, data);
  274. this.page++;
  275. this.getData();
  276. },
  277. //执行聊天泡泡
  278. handle : function(items) {
  279. if (!this.play) {
  280. return;
  281. }
  282. this.cycle && (clearInterval(this.cycle));
  283. var i = 0;
  284. var len = items.length;
  285. this.tips(items[i]['type_id'], items[i]['content']);
  286. i++;
  287. this.cycle = setInterval(() => {
  288. var time = 5;
  289. // #ifndef H5
  290. time = Math.ceil(Math.floor(Math.random() * (this.maxTime - this.minTime + 1) + this.minTime));
  291. // #endif
  292. if (!this.play) {
  293. clearInterval(this.cycle);
  294. } else if (i < len) {
  295. this.tips(items[i]['type_id'], items[i]['content']);
  296. i++;
  297. } else {
  298. clearInterval(this.cycle);
  299. }
  300. }, 1000)
  301. },
  302. //初始座位数组
  303. initSeatArray: function() {
  304. let seatArray = Array(this.seatRow).fill(0).map(() => Array(this.seatCol).fill({
  305. type: -1,
  306. SeatCode: '',
  307. RowNum: '',
  308. ColumnNum: ''
  309. }));
  310. this.seatArray = seatArray
  311. this.seatSize = this.boxWidth > 0 ?
  312. parseInt(parseInt(this.boxWidth, 10) / (this.seatCol + 1), 10) :
  313. parseInt(parseInt(414, 10) / (this.seatCol + 1), 10)
  314. this.initNonSeatPlace();
  315. },
  316. //初始化是座位的地方
  317. initNonSeatPlace: function() {
  318. let seat = this.seatList.slice()
  319. let arr = this.seatArray.slice()
  320. for (let num in seat) {
  321. let status = 2 //-1为非座位,0为未购座位,1为已选座位(绿色),2为已购座位(红色)
  322. if (seat[num].Status === 0) {
  323. status = 0
  324. } else if (seat[num].Status === -1) {
  325. status = -1
  326. }
  327. arr[parseInt(seat[num].YCoord) - this.minRow][parseInt(seat[num].XCoord) - this.minCol] = {
  328. type: status,
  329. SeatCode: seat[num].SeatCode,
  330. RowNum: seat[num].RowNum,
  331. ColumnNum: seat[num].ColumnNum,
  332. User: seat[num].User,
  333. Id : seat[num].Id,
  334. Tips : seat[num].Tips,
  335. TipsId : 'tips_' + this.type_id + '_' + seat[num].Id
  336. }
  337. }
  338. this.seatArray = arr.slice()
  339. let mArr = []
  340. for (let i in arr) {
  341. let m = ''
  342. for (let n of arr[i]) {
  343. if (n.SeatCode) {
  344. m = n.RowNum
  345. }
  346. }
  347. if (m) {
  348. mArr.push(m)
  349. } else {
  350. mArr.push('')
  351. }
  352. }
  353. this.mArr = mArr
  354. },
  355. //放大缩小事件
  356. onScale: function(e) {
  357. this.showTis = false
  358. // this.moveX=-e.detail.x
  359. let w = this.boxWidth * 0.5
  360. let s = 1 - e.detail.scale
  361. this.moveX = w * s
  362. this.scale = e.detail.scale
  363. if (s > 0 || s === 0) {
  364. this.showTis = true
  365. }
  366. },
  367. //移动事件
  368. onMove: function(e) {
  369. this.showTis = false
  370. this.moveX = e.detail.x
  371. },
  372. //重置座位
  373. resetSeat: function() {
  374. this.SelectNum = 0
  375. this.optArr = []
  376. //将所有已选座位的值变为0
  377. let oldArray = this.seatArray.slice();
  378. for (let i = 0; i < this.seatRow; i++) {
  379. for (let j = 0; j < this.seatCol; j++) {
  380. if (oldArray[i][j].type === 1) {
  381. oldArray[i][j].type = 0
  382. }
  383. }
  384. }
  385. this.seatArray = oldArray;
  386. },
  387. //选定且购买座位
  388. buySeat: function() {
  389. if (this.SelectNum === 0) {
  390. return
  391. }
  392. let oldArray = [];
  393. for (let i = 0; i < this.seatRow; i++) {
  394. for (let j = 0; j < this.seatCol; j++) {
  395. if (this.seatArray[i][j].type === 1) {
  396. oldArray.push(this.seatArray[i][j].SeatCode)
  397. }
  398. }
  399. }
  400. this.buy(oldArray);
  401. },
  402. buy : function(seat) {
  403. seat = seat.join(',');
  404. var self = this;
  405. this.Dever.confirm('确定购买座位吗?公测期间免费~', function() {
  406. self.Dever.post('app/user/?l=api.seatSave', {code:self.Dever.config.code, seat:seat, content_id : self.type_id}, function(t) {
  407. self.Dever.alert('选座成功,您可以点击头像发布内容~');
  408. self.resetSeat();
  409. self.initData(self.hall);
  410. });
  411. })
  412. },
  413. //处理座位选择逻辑
  414. handleChooseSeat: function(row, col) {
  415. let seatValue = this.seatArray[row][col].type;
  416. let newArray = this.seatArray;
  417. //如果是已购座位,直接返回
  418. if (seatValue === 2 || seatValue === -1) return
  419. //如果是已选座位点击后变未选
  420. if (seatValue === 1) {
  421. newArray[row][col].type = 0
  422. this.SelectNum--
  423. this.getOptArr(newArray[row][col], 0)
  424. } else if (seatValue === 0) {
  425. if (this.SelectNum >= 4) {
  426. this.Dever.alert('一次最多只能购买4个座位');
  427. return;
  428. }
  429. newArray[row][col].type = 1
  430. this.SelectNum++
  431. this.getOptArr(newArray[row][col], 1)
  432. }
  433. //必须整体更新二维数组,Vue无法检测到数组某一项更新,必须slice复制一个数组才行
  434. this.seatArray = newArray.slice();
  435. },
  436. //处理已选座位数组
  437. getOptArr: function(item, type) {
  438. let optArr = this.optArr
  439. if (type === 1) {
  440. optArr.push(item)
  441. } else if (type === 0) {
  442. let arr = []
  443. optArr.forEach(v => {
  444. if (v.SeatCode !== item.SeatCode) {
  445. arr.push(v)
  446. }
  447. })
  448. optArr = arr
  449. }
  450. this.optArr = optArr.slice()
  451. },
  452. //推荐选座,参数是推荐座位数目,
  453. smartChoose: function(num) {
  454. //console.log('num===', num)
  455. // 先重置
  456. this.resetSeat()
  457. //找到影院座位水平垂直中间位置的后一排
  458. let rowStart = parseInt((this.seatRow - 1) / 2, 10) + 1;
  459. //先从中间排往后排搜索
  460. let backResult = this.searchSeatByDirection(rowStart, this.seatRow - 1, num);
  461. if (backResult.length > 0) {
  462. this.chooseSeat(backResult);
  463. this.SelectNum += num
  464. return
  465. }
  466. //再从中间排往前排搜索
  467. let forwardResult = this.searchSeatByDirection(rowStart - 1, 0, num);
  468. if (forwardResult.length > 0) {
  469. this.chooseSeat(forwardResult);
  470. this.SelectNum += num
  471. return
  472. }
  473. //提示用户无合法位置可选
  474. alert('无合法位置可选!')
  475. },
  476. //搜索函数,参数:fromRow起始行,toRow终止行,num推荐座位数
  477. searchSeatByDirection: function(fromRow, toRow, num) {
  478. /*
  479. * 推荐座位规则
  480. * (1)初始状态从座位行数的一半处的后一排的中间开始向左右分别搜索,取离中间最近的,如果满足条件,
  481. * 记录下该结果离座位中轴线的距离,后排搜索完成后取距离最小的那个结果座位最终结果,优先向后排进行搜索,
  482. * 后排都没有才往前排搜,前排逻辑同上
  483. *
  484. * (2)只考虑并排且连续的座位,不能不在一排或者一排中间有分隔
  485. *
  486. * */
  487. /*
  488. * 保存当前方向搜索结果的数组,元素是对象,result是结果数组,offset代表与中轴线的偏移距离
  489. * {
  490. * result:Array([x,y])
  491. * offset:Number
  492. * }
  493. *
  494. */
  495. let currentDirectionSearchResult = [];
  496. let largeRow = fromRow > toRow ? fromRow : toRow,
  497. smallRow = fromRow > toRow ? toRow : fromRow;
  498. for (let i = smallRow; i <= largeRow; i++) {
  499. //每一排的搜索,找出该排里中轴线最近的一组座位
  500. let tempRowResult = [],
  501. minDistanceToMidLine = Infinity;
  502. for (let j = 0; j <= this.seatCol - num; j++) {
  503. //如果有合法位置
  504. if (this.checkRowSeatContinusAndEmpty(i, j, j + num - 1)) {
  505. //计算该组位置距离中轴线的距离:该组位置的中间位置到中轴线的距离
  506. let resultMidPos = parseInt((j + num / 2), 10);
  507. let distance = Math.abs(parseInt(this.seatCol / 2) - resultMidPos);
  508. //如果距离较短则更新
  509. if (distance < minDistanceToMidLine) {
  510. minDistanceToMidLine = distance;
  511. //该行的最终结果
  512. tempRowResult = this.generateRowResult(i, j, j + num - 1)
  513. }
  514. }
  515. }
  516. //保存该行的最终结果
  517. currentDirectionSearchResult.push({
  518. result: tempRowResult,
  519. offset: minDistanceToMidLine
  520. })
  521. }
  522. //处理后排的搜索结果:找到距离中轴线最短的一个
  523. //注意这里的逻辑需要区分前后排,对于后排是从前往后,前排则是从后往前找
  524. let isBackDir = fromRow < toRow;
  525. let finalReuslt = [],
  526. minDistanceToMid = Infinity;
  527. if (isBackDir) {
  528. //后排情况,从前往后
  529. currentDirectionSearchResult.forEach((item) => {
  530. if (item.offset < minDistanceToMid) {
  531. finalReuslt = item.result;
  532. minDistanceToMid = item.offset;
  533. }
  534. });
  535. } else {
  536. //前排情况,从后往前找
  537. currentDirectionSearchResult.reverse().forEach((item) => {
  538. if (item.offset < minDistanceToMid) {
  539. finalReuslt = item.result;
  540. minDistanceToMid = item.offset;
  541. }
  542. })
  543. }
  544. //直接返回结果
  545. return finalReuslt
  546. },
  547. /*辅助函数,判断每一行座位从i列到j列是否全部空余且连续
  548. *
  549. */
  550. checkRowSeatContinusAndEmpty: function(rowNum, startPos, endPos) {
  551. let isValid = true;
  552. for (let i = startPos; i <= endPos; i++) {
  553. if (this.seatArray[rowNum][i].type !== 0) {
  554. isValid = false;
  555. break;
  556. }
  557. }
  558. return isValid
  559. },
  560. //辅助函数:返回每一行的某个合理位置的座位数组
  561. generateRowResult: function(row, startPos, endPos) {
  562. let result = [];
  563. for (let i = startPos; i <= endPos; i++) {
  564. result.push([row, i])
  565. }
  566. return result
  567. },
  568. //辅助函数:智能推荐的选座操作
  569. chooseSeat: function(result) {
  570. let opt = this.optArr
  571. let oldArray = this.seatArray.slice();
  572. for (let i = 0; i < result.length; i++) {
  573. //选定座位
  574. oldArray[result[i][0]][result[i][1]].type = 1
  575. this.optArr.push(oldArray[result[i][0]][result[i][1]])
  576. }
  577. this.seatArray = oldArray;
  578. },
  579. }
  580. }
  581. </script>
  582. <style lang="scss" scoped>
  583. .main {
  584. position: relative;
  585. }
  586. .p-all-10{
  587. padding: 10rpx;
  588. }
  589. .ml-10 {
  590. margin-left: 10rpx;
  591. }
  592. .m-0-10 {
  593. margin: 0 10rpx;
  594. }
  595. .bg-unbtn {
  596. background-color: #f9abb3;
  597. }
  598. .bg-red-1 {
  599. background-color: #F45664;
  600. }
  601. .br-10 {
  602. border-radius: 10rpx;
  603. }
  604. .ml-20 {
  605. margin-left: 20rpx;
  606. }
  607. .mb-20 {
  608. margin-bottom: 20rpx;
  609. }
  610. .p-all-32 {
  611. padding: 32rpx;
  612. }
  613. .fd-cr {
  614. flex-direction: column-reverse;
  615. /* 主轴方向从下到上,默认从左到右 */
  616. }
  617. .bottom-bar {
  618. bottom: var(--window-bottom);
  619. }
  620. .color-fff {
  621. color: #fff
  622. }
  623. .br-15 {
  624. border-radius: 15rpx;
  625. }
  626. .over-h {
  627. overflow: hidden;
  628. }
  629. .dp-ib {
  630. display: inline-block;
  631. }
  632. .mt-20 {
  633. margin-top: 20rpx;
  634. }
  635. .pa-v-2 {
  636. /* 定位垂直对齐 */
  637. left: 50%;
  638. transform: translateX(-50%)
  639. }
  640. .b-d-1 {
  641. border: 1px dashed #e5e5e5;
  642. }
  643. .w-100 {
  644. width: 100%;
  645. }
  646. .h-100 {
  647. height: 100%;
  648. }
  649. .bg-f1 {
  650. background-color: #f1f1f1;
  651. }
  652. .h-100vh {
  653. height: 100vh;
  654. }
  655. .pt-f {
  656. position: fixed;
  657. }
  658. .left-0 {
  659. left: 0;
  660. }
  661. .p-0-32 {
  662. padding: 0 32rpx;
  663. }
  664. .pt-20 {
  665. padding-top: 20rpx;
  666. }
  667. .bg-white {
  668. background-color: #fff;
  669. }
  670. .z1000 {
  671. z-index: 1000;
  672. }
  673. .fz-34 {
  674. font-size: 34rpx;
  675. }
  676. .fw-b {
  677. font-weight: bold;
  678. }
  679. .mt-10 {
  680. margin-top: 10rpx;
  681. }
  682. .fz-28 {
  683. font-size: 28rpx;
  684. }
  685. .color-666 {
  686. color: #666666
  687. }
  688. .dp-f {
  689. display: flex;
  690. }
  691. .jc-c {
  692. justify-content: center;
  693. }
  694. .ai-c {
  695. align-items: center;
  696. }
  697. .fz-22 {
  698. font-size: 22rpx;
  699. }
  700. .color-333 {
  701. color: #333333
  702. }
  703. .m-0-a {
  704. margin: 0 auto;
  705. }
  706. .mt-48 {
  707. margin-top: 48rpx;
  708. }
  709. .fz-20 {
  710. font-size: 20rpx;
  711. }
  712. .color-999 {
  713. color: #999999
  714. }
  715. .b-1 {
  716. border: 1px solid #CCCCCC;
  717. }
  718. .br-5 {
  719. border-radius: 5rpx;
  720. }
  721. .Stage {
  722. background-color: #dddddd;
  723. width: 380rpx;
  724. height: 34rpx;
  725. transform: perspective(34rpx) rotateX(-10deg);
  726. margin: 0 auto;
  727. }
  728. .bg-line {
  729. background-color: rgba(0, 0, 0, 0.3);
  730. }
  731. .sel-seat {
  732. background: url('@/static/seat/selected.png') center center no-repeat;
  733. background-size: 100% 100%;
  734. }
  735. .unsel-seat {
  736. background: url('@/static/seat/unselected.png') center center no-repeat;
  737. background-size: 100% 100%;
  738. }
  739. .bought-seat {
  740. background: url('@/static/seat/bought.png') center center no-repeat;
  741. background-size: 100% 100%;
  742. }
  743. </style>