kj-tabbar.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <view id="tabber" style="position: fixed; z-index: 1000; bottom: 0">
  3. <view class="bottom u-flex u-row-between" v-if="value1 == 3">
  4. <view class="u-flex">
  5. <u-checkbox-group v-model="all" placement="column" @change="checkAll">
  6. <u-checkbox shape="circle" :name="i18n.selectall" activeColor="#F83224">
  7. </u-checkbox>
  8. </u-checkbox-group>
  9. <text class="all">{{ i18n.selectall }}</text>
  10. </view>
  11. <view v-if="success == false" class="dle">
  12. {{ i18n.delete }}
  13. </view>
  14. <view class="u-flex" v-else>
  15. <view class="">
  16. <text class="allweight">{{ i18n.Grossweight }} </text>
  17. <text class="allweight"> {{ goodsWeight }}kg,</text>
  18. <text class="sum">{{ i18n.total }}:</text>
  19. <text class="summon">¥</text>
  20. <text class="summon" style="font-size: 36rpx">{{
  21. goodsPrice.split(".")[0]
  22. }}</text>
  23. <text class="summon">.{{ goodsPrice.split(".")[1] }}</text>
  24. </view>
  25. <view class="settle" @click="account">{{ i18n.GotoResult }}</view>
  26. </view>
  27. </view>
  28. <u-tabbar :list="list" active-color="#F83224" inactive-color="#333" :value="value1">
  29. <u-tabbar-item v-for="(item, idx) in list" @click="click1" :key="idx" :text="item.text">
  30. <image style="width: 40rpx; height: 40rpx" class="u-page__item__slot-icon" slot="inactive-icon"
  31. :src="item.iconPath"></image>
  32. <image style="width: 40rpx; height: 40rpx" class="u-page__item__slot-icon" slot="active-icon"
  33. :src="item.selectedIconPath"></image>
  34. </u-tabbar-item>
  35. </u-tabbar>
  36. </view>
  37. </template>
  38. <script>
  39. import {
  40. nextTick
  41. } from "vue";
  42. import {
  43. mapState
  44. } from "vuex";
  45. export default {
  46. name: "kj-tabbar",
  47. props: {
  48. value1: {
  49. type: Number,
  50. default: 0,
  51. },
  52. goodsWeight: {
  53. type: Number,
  54. default: 0,
  55. },
  56. goodsPrice: {
  57. type: String,
  58. default: "",
  59. },
  60. //购物车所有商品
  61. goodsList: {
  62. type: Array,
  63. default: () => {
  64. return [];
  65. },
  66. },
  67. //购物车选中的商品
  68. checkboxValue1: {
  69. type: Array,
  70. default: () => {
  71. return [];
  72. },
  73. },
  74. },
  75. computed: {
  76. i18n() {
  77. return this.$t("index");
  78. },
  79. },
  80. data() {
  81. return {
  82. success: true,
  83. all: [],
  84. language: 'zh-CN',
  85. selegoods: [],
  86. stringcheck:[]
  87. };
  88. },
  89. onLoad() {},
  90. computed: {
  91. i18n() {
  92. return this.$t('index')
  93. },
  94. list() {
  95. var list = [{
  96. iconPath: "../../static/express1.png",
  97. selectedIconPath: "../../static/express2.png",
  98. text: '跨境速递',
  99. pagePath: "pages/express/express",
  100. },
  101. {
  102. iconPath: "../../static/index1.png",
  103. selectedIconPath: "../../static/index2.png",
  104. text: "商城",
  105. pagePath: "pages/index/index",
  106. },
  107. {
  108. iconPath: "../../static/shop.png",
  109. selectedIconPath: "../../static/shop.png",
  110. text: "购",
  111. pagePath: "pages/shopping/shopping",
  112. },
  113. {
  114. iconPath: "../../static/cart1.png",
  115. selectedIconPath: "../../static/cart2.png",
  116. text: "购物车",
  117. pagePath: "pages/cart/cart",
  118. },
  119. {
  120. iconPath: "../../static/mine1.png",
  121. selectedIconPath: "../../static/mine2.png",
  122. text: "我的",
  123. pagePath: "pages/mine/mine",
  124. },
  125. ]
  126. list[0].text = this.i18n.border
  127. list[1].text = this.i18n.shop
  128. list[2].text = this.i18n.chase
  129. list[3].text = this.i18n.Shopping
  130. list[4].text = this.i18n.mine
  131. return list
  132. }
  133. },
  134. created() {
  135. if (uni.getStorageSync('language') != '') {
  136. this.language = uni.getStorageSync('language')
  137. }
  138. // if (uni.getStorageSync('tabbar')!=1) {
  139. // this.value1 = uni.getStorageSync('tabbar')
  140. // }
  141. // const dom = uni.createSelectorQuery("#tabber")
  142. },
  143. methods: {
  144. account() {
  145. console.log(this.checkboxValue1);
  146. console.log(this.goodsList);
  147. this.selegoods = []
  148. this.goodsList.map((item) => {
  149. item.goods.map((items) => {
  150. if (this.checkboxValue1.indexOf(items.cart.sku_item_id) > -1) {
  151. // item.selegoods
  152. console.log(items);
  153. this.selegoods = this.selegoods.concat(items)
  154. this.stringcheck = this.stringcheck.concat(items.cart.id)
  155. }
  156. });
  157. });
  158. this.$nextTick(() => {
  159. uni.navigateTo({
  160. url: "/pageA/order?selelist=" + encodeURIComponent(JSON.stringify(this
  161. .selegoods)) + '&typea=' + 'shop' + '&goodsPrice=' + this.goodsPrice +
  162. '&goodsWeight=' + this.goodsWeight + '&stringcheck=' + this.stringcheck.toString(),
  163. });
  164. })
  165. },
  166. getLabelHeight() {
  167. const dom = uni.createSelectorQuery("#tabber");
  168. console.log(dom);
  169. },
  170. // click1(e) {
  171. // this.value1 = e
  172. // console.log(e);
  173. // if (this.value1 == 4) {
  174. // uni.redirectTo({
  175. // url: '../../pages/mine/mine'
  176. // })
  177. // }
  178. // if (this.value1 == 0) {
  179. // uni.redirectTo({
  180. // url: '../../pages/express/express'
  181. // })
  182. // }
  183. // if (this.value1 == 1) {
  184. // uni.redirectTo({
  185. // url: '../../pages/index/index'
  186. // })
  187. // }
  188. // if (this.value1 == 2) {
  189. // uni.redirectTo({
  190. // url: '../../pages/shopping/shopping'
  191. // })
  192. // }
  193. // if (this.value1 == 3) {
  194. // uni.redirectTo({
  195. // url: '../../pages/cart/cart'
  196. // })
  197. // }
  198. // uni.setStorageSync('tabbar', e)
  199. // },
  200. checkAll() {
  201. this.$emit("allSelect");
  202. },
  203. //
  204. cancelAll(value) {
  205. if (value == "全选") {
  206. return this.all;
  207. } else if (value == "取消") {
  208. this.all = [];
  209. } else {
  210. this.all.push(this.i18n.selectall);
  211. }
  212. },
  213. click1(e) {
  214. if (e == 4) {
  215. uni.switchTab({
  216. url: "../../pages/mine/mine",
  217. });
  218. }
  219. if (e == 0) {
  220. uni.switchTab({
  221. url: "../../pages/express/express",
  222. });
  223. }
  224. if (e == 1) {
  225. uni.switchTab({
  226. url: "../../pages/index/index",
  227. });
  228. }
  229. if (e == 2) {
  230. uni.switchTab({
  231. url: "../../pages/shopping/shopping",
  232. });
  233. }
  234. if (e == 3) {
  235. uni.switchTab({
  236. url: "../../pages/cart/cart",
  237. });
  238. }
  239. // uni.setStorageSync('tabbar', e)
  240. },
  241. },
  242. // created() {},
  243. // computed: {
  244. // ...mapState(['config'])
  245. // },
  246. // watch: {
  247. // config: {
  248. // handler(val) {
  249. // if (val.report_switch == 1) {
  250. // this.list = [{
  251. // "iconPath": "/static/images/index.png",
  252. // "pagePath": "/pages/index/index",
  253. // "selectedIconPath": "/static/images/index1.png",
  254. // "text": "首页"
  255. // },
  256. // {
  257. // "iconPath": "/static/images/video.png",
  258. // "pagePath": "/pages/video/video",
  259. // "selectedIconPath": "/static/images/video1.png",
  260. // "text": "视频"
  261. // },
  262. // {
  263. // "iconPath": "/static/images/baobei.png",
  264. // "pagePath": "/pages/baobei/baobei",
  265. // "selectedIconPath": "/static/images/baobei1.png",
  266. // "text": "客户报备"
  267. // },
  268. // {
  269. // "iconPath": "/static/images/mine.png",
  270. // "pagePath": "/pages/mine/mine",
  271. // "selectedIconPath": "/static/images/mine1.png",
  272. // "text": "我的"
  273. // }
  274. // ]
  275. // }
  276. // },
  277. // deep: true
  278. // }
  279. // }
  280. };
  281. </script>
  282. <style lang="scss" scoped>
  283. .all {
  284. font-family: PingFangSC, PingFang SC;
  285. font-weight: 400;
  286. font-size: 22rpx;
  287. color: #444444;
  288. line-height: 32rpx;
  289. text-align: left;
  290. font-style: normal;
  291. }
  292. .bottom {
  293. width: 750rpx;
  294. height: 100rpx;
  295. background: #ffffff;
  296. padding: 0 24rpx;
  297. box-sizing: border-box;
  298. .allweight {
  299. font-family: PingFangSC, PingFang SC;
  300. font-weight: 400;
  301. font-size: 22rpx;
  302. color: #333333;
  303. line-height: 32rpx;
  304. text-align: left;
  305. font-style: normal;
  306. }
  307. .sum {
  308. font-family: PingFangSC, PingFang SC;
  309. font-weight: 400;
  310. font-size: 22rpx;
  311. color: #333333;
  312. line-height: 32rpx;
  313. text-align: left;
  314. font-style: normal;
  315. }
  316. .summon {
  317. font-family: JDZhengHT, JDZhengHT;
  318. font-weight: 400;
  319. font-size: 24rpx;
  320. color: #ff1515;
  321. line-height: 30rpx;
  322. text-align: left;
  323. font-style: normal;
  324. }
  325. .settle {
  326. width: 176rpx;
  327. height: 68rpx;
  328. background: #f83224;
  329. border-radius: 38rpx;
  330. font-family: PingFangSC, PingFang SC;
  331. font-weight: 500;
  332. font-size: 28rpx;
  333. color: #ffffff;
  334. line-height: 68rpx;
  335. text-align: center;
  336. font-style: normal;
  337. margin-left: 20rpx;
  338. }
  339. }
  340. </style>