a0741cb45007721796a39deec2a48cab8b407223.svn-base 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <!--
  2. * @Description: In User Settings Edit
  3. * @Author: your name
  4. * @Date: 2019-08-26 10:58:22
  5. * @LastEditTime: 2019-08-27 11:56:47
  6. * @LastEditors: Please set LastEditors
  7. -->
  8. <template>
  9. <div>
  10. <div v-if="isDisplay">
  11. <yd-accordion>
  12. <!-- 组件标题 -->
  13. <yd-accordion-item class="Match-game" title="总进球数" open>
  14. <div v-for="item in data" :key="item.id" class="list-row" v-if="!item.odds_code.endsWith('h')">
  15. <span class="The-club">{{ item.condition }}</span>
  16. <span v-if="item.odds >0" class="The-club-box" :class="{active:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  17. @click="bettingBtn(item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id,item.odds_code,'总进球数',item.condition,item.oddsType)"
  18. >{{ item.odds }}</span>
  19. <div v-else class="ratio column center">
  20. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  21. </div>
  22. <!-- </div> -->
  23. </div>
  24. </yd-accordion-item>
  25. </yd-accordion>
  26. <yd-accordion>
  27. <!-- 组件标题 -->
  28. <yd-accordion-item class="Match-game" title="总进球数-上半场" open>
  29. <div v-for="item in data" :key="item.id" class="list-row" v-if="item.odds_code.endsWith('h')">
  30. <span class="The-club">{{ item.condition }}</span>
  31. <span v-if="item.odds >0" class="The-club-box" :class="{active:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  32. @click="bettingBtn(item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id,item.odds_code,'总进球数-上半场',item.condition,item.oddsType)"
  33. >{{ item.odds }}</span>
  34. <div v-else class="ratio column center">
  35. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  36. </div>
  37. <!-- </div> -->
  38. </div>
  39. </yd-accordion-item>
  40. </yd-accordion>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. export default {
  46. //总进球数
  47. data() {
  48. return {
  49. title: "TG",
  50. data: [],
  51. home_team: "", //主队
  52. match_id: "",
  53. guest_team: "", //客队
  54. score: "0,0", //比分
  55. lg_id: "",
  56. isDisplay: false, //是否显示
  57. betting: [], //获取vuex本组件类已投注倍率数据集合
  58. dataNum: 10000 //对应的数据的下标
  59. };
  60. },
  61. methods: {
  62. //玩法投注
  63. bettingBtn(
  64. id,
  65. name,
  66. odds,
  67. odds_only,
  68. p_code,
  69. match_id,
  70. odds_code,
  71. play_name,
  72. condition = "",
  73. oddsType,
  74. bettingTime = ""
  75. ) {
  76. let _this = this;
  77. let bettingInfo = {
  78. id,
  79. home_team: this.home_team,
  80. guest_team: this.guest_team,
  81. name:'',
  82. odds,
  83. condition,
  84. ballId: this.$store.getters.getBallId,
  85. p_code,
  86. match_id,
  87. odds_code,
  88. play_name,
  89. score: this.score,
  90. lg_id: this.lg_id,
  91. odds_id: id,
  92. bettingTime,
  93. odds_only,
  94. oddsType
  95. };
  96. // console.log(this.data,'bbb')
  97. //调用玩法投注公共方法
  98. this.$public.bettingFunction(
  99. this.betting,
  100. bettingInfo,
  101. this.data,
  102. this.$store.getters.getBetting,
  103. this.title,
  104. this.dataNum,
  105. this.$store.getters.getLimit,
  106. function(res, type) {
  107. _this.$set(res, "isTrue", type);
  108. },
  109. function(data, val, type) {
  110. if (type) {
  111. _this.$dialog.alert({ mes: "你的注单已达到上限啦!" });
  112. }
  113. _this.$store.dispatch("BETTING", []);
  114. _this.$store.dispatch("BETTING", data ? data : val);
  115. if (_this.$store.getters.getIsBetting == "100") return false;
  116. _this.$store.dispatch("ISBETTING", "100");
  117. }
  118. );
  119. },
  120. //数据排序处理
  121. dataSorting(data){
  122. data.sort(function(a,b){
  123. return a.condition.substring(0,1)*1-b.condition.substring(0,1)*1
  124. })
  125. this.data= data;
  126. // console.log(data);
  127. }
  128. },
  129. /**
  130. * 计算属性
  131. */
  132. computed: {
  133. /*------------------------------------------------------------ */
  134. getUserIcons() {
  135. return this.$store.getters.getGameRatio;
  136. },
  137. /*------------------------------------------------------------ */
  138. getBetting() {
  139. return this.$store.getters.getBetting;
  140. },
  141. //获取投注框删除的投注信息
  142. getDeleteType() {
  143. return this.$store.getters.getDeleteType;
  144. }
  145. },
  146. /**
  147. * 监听器
  148. */
  149. watch: {
  150. /*------------------------------------------------------------ */
  151. getUserIcons(val) {
  152. this.match_id = val.match_id;
  153. //console.log("更新数据", val);
  154. if (!val) return false;
  155. let _this = this;
  156. this.home_team = val.home_team;
  157. this.guest_team = val.guest_team;
  158. this.lg_id = val.lg_id;
  159. val.oddsData.forEach(res => {
  160. if (res[0].p_code == this.title) {
  161. this.isDisplay = true;
  162. this.dataSorting(res);
  163. // console.log(res);
  164. // this.data = res;
  165. }
  166. });
  167. this.$public.getBettingId(
  168. this.$store.getters.getBetting,
  169. this.title,
  170. function(data, index) {
  171. _this.betting = data;
  172. _this.dataNum = index;
  173. }
  174. );
  175. // console.log('总进球数',this.dataNum);
  176. if (this.dataNum != 10000) {
  177. this.betting.forEach(res => {
  178. this.data.forEach((e, index) => {
  179. if (res.id == e.id) {
  180. this.$set(e, "isTrue", true);
  181. }
  182. });
  183. });
  184. }
  185. },
  186. /*------------------------------------------------------------ */
  187. //获取已投注信息
  188. getBetting(val) {
  189. let _this = this;
  190. this.$public.getBettingId(val, this.title, function(data, index) {
  191. _this.betting = data;
  192. _this.dataNum = index;
  193. });
  194. },
  195. //监听投注框删除处理
  196. getDeleteType(val) {
  197. this.data.forEach(e => {
  198. if (val == "all") {
  199. this.$set(e, "isTrue", false);
  200. } else {
  201. if (e.id == val) {
  202. this.$set(e, "isTrue", false);
  203. }
  204. }
  205. });
  206. }
  207. }
  208. };
  209. </script>
  210. <style scoped>
  211. div /deep/ .yd-accordion-head-arrow:after {
  212. border: none;
  213. width: 0.5rem;
  214. height: 0.5rem;
  215. background: url(../assets/st-imges/xiangxia.png) no-repeat;
  216. background-size: 100% 100%;
  217. }
  218. div /deep/ .yd-accordion-head,
  219. div /deep/ .yd-accordion-head-content,
  220. div /deep/ .yd-accordion-title {
  221. font-size: 0.28rem;
  222. color: #fefefe;
  223. background: #a0a0a0;
  224. }
  225. div /deep/ .yd-accordion-head {
  226. padding: 0 0.32rem;
  227. }
  228. /*
  229. .Match-game-stat {
  230. position: absolute;
  231. right: 1.35rem;
  232. color: #fd8f26;
  233. font-size: 0.23rem;
  234. }*/
  235. .Match-game {
  236. position: relative;
  237. }
  238. .list-row {
  239. display: flex;
  240. justify-content: space-between;
  241. height: 0.87rem;
  242. background: #f4f4f4;
  243. border-bottom: 1px solid #e4e4e4;
  244. align-items: center;
  245. padding: 0 0.32rem;
  246. }
  247. .The-club {
  248. font-size: 0.26rem;
  249. }
  250. .The-club-box {
  251. display: inline-block;
  252. display: flex;
  253. flex-wrap: wrap;
  254. align-items: center;
  255. justify-content: center;
  256. width: 1.07rem;
  257. height: 0.76rem;
  258. font-size: 0.24rem;
  259. padding: 0.1rem;
  260. border: 1px solid #cecece;
  261. border-radius: 0.1rem;
  262. margin-right: 0.1rem;
  263. }
  264. .active {
  265. background: #f76649;
  266. color: #f4f4f4;
  267. padding: 0.1rem;
  268. border: 2px solid #f76649;
  269. }
  270. .active i {
  271. color: #f4f4f4 !important;
  272. }
  273. .ratio {
  274. width: 1.07rem;
  275. height: 0.76rem;
  276. border: 1px solid #cecece;
  277. margin-right: 0.14rem;
  278. border-radius: 0.1rem;
  279. margin: 0.06rem;
  280. }
  281. </style>