kj-tabbar.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  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" class="dle" @click="$emit('selectDelete')">
  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. success: {
  75. type: Boolean,
  76. default: true,
  77. },
  78. },
  79. computed: {
  80. i18n() {
  81. return this.$t("index");
  82. },
  83. },
  84. data() {
  85. return {
  86. all: [],
  87. language: "zh-CN",
  88. selegoods: [],
  89. stringcheck: [],
  90. skuitemid: [],
  91. volume: '',
  92. cartid: [],
  93. ten_yuan_image:''
  94. };
  95. },
  96. computed: {
  97. i18n() {
  98. return this.$t("index");
  99. },
  100. list() {
  101. var list = [{
  102. iconPath: "../../static/express1.png",
  103. selectedIconPath: "../../static/express2.png",
  104. text: "跨境速递",
  105. pagePath: "pages/express/express",
  106. },
  107. {
  108. iconPath: "../../static/index1.png",
  109. selectedIconPath: "../../static/index2.png",
  110. text: "商城",
  111. pagePath: "pages/index/index",
  112. },
  113. {
  114. iconPath: "../../static/shop.png",
  115. selectedIconPath: "../../static/shop.png",
  116. text: "购",
  117. pagePath: "pages/shopping/shopping",
  118. },
  119. {
  120. iconPath: "../../static/cart1.png",
  121. selectedIconPath: "../../static/cart2.png",
  122. text: "购物车",
  123. pagePath: "pages/cart/cart",
  124. },
  125. {
  126. iconPath: "../../static/mine1.png",
  127. selectedIconPath: "../../static/mine2.png",
  128. text: "我的",
  129. pagePath: "pages/mine/mine",
  130. },
  131. ];
  132. list[2].iconPath = this.ten_yuan_image
  133. list[2].selectedIconPath = this.ten_yuan_image
  134. list[0].text = this.i18n.border;
  135. list[1].text = this.i18n.shop;
  136. list[2].text = this.i18n.chase;
  137. list[3].text = this.i18n.Shopping;
  138. list[4].text = this.i18n.mine;
  139. return list;
  140. },
  141. },
  142. created() {
  143. this.all = []
  144. if (uni.getStorageSync("language") != "") {
  145. this.language = uni.getStorageSync("language");
  146. }
  147. this.getimage()
  148. // if (uni.getStorageSync('tabbar')!=1) {
  149. // this.value1 = uni.getStorageSync('tabbar')
  150. // }
  151. // const dom = uni.createSelectorQuery("#tabber")
  152. },
  153. methods: {
  154. getimage() {
  155. uni.$u.http.get('/api/config', {
  156. params: {
  157. module: 'basic'
  158. }
  159. }).then((res) => {
  160. this.ten_yuan_image = res.ten_yuan_image
  161. }).catch(() => {
  162. })
  163. },
  164. account() {
  165. if (this.checkboxValue1.length == 0) {
  166. this.$u.toast('请选择商品')
  167. } else {
  168. console.log(this.checkboxValue1);
  169. console.log(this.goodsList);
  170. this.selegoods = [];
  171. this.skuitemid = []
  172. this.cartid = []
  173. this.goodsList.map((item) => {
  174. item.goods.map((items) => {
  175. console.log('items', items);
  176. if (this.checkboxValue1.indexOf(items.cart.id) > -1) {
  177. this.selegoods = this.selegoods.concat(items);
  178. this.stringcheck = this.stringcheck.concat(items.cart.id);
  179. this.skuitemid = this.skuitemid.concat(items.cart.sku_item_id);
  180. if (items.is_shipping == 1) {
  181. this.cartid = this.cartid.concat(items.cart.id);
  182. }
  183. console.log('333333333', this.selegoods);
  184. }
  185. });
  186. });
  187. uni.$u.http
  188. .get(`/api/order_goods_volume?sku_item_id=` + this.skuitemid.toString(), {
  189. })
  190. .then((res) => {
  191. console.log('weight', res);
  192. this.volume = res
  193. });
  194. this.$nextTick(() => {
  195. uni.navigateTo({
  196. url: "/pageA/order?selelist=" +
  197. encodeURIComponent(JSON.stringify(this.selegoods)) +
  198. "&typea=" +
  199. "shop" +
  200. "&goodsPrice=" +
  201. this.goodsPrice +
  202. "&goodsWeight=" +
  203. this.goodsWeight +
  204. "&stringcheck=" +
  205. this.stringcheck.toString() + '&volume=' + this.volume + '&cartid=' + this
  206. .cartid.toString()
  207. });
  208. });
  209. }
  210. },
  211. getLabelHeight() {
  212. const dom = uni.createSelectorQuery("#tabber");
  213. console.log(dom);
  214. },
  215. // click1(e) {
  216. // this.value1 = e
  217. // console.log(e);
  218. // if (this.value1 == 4) {
  219. // uni.redirectTo({
  220. // url: '../../pages/mine/mine'
  221. // })
  222. // }
  223. // if (this.value1 == 0) {
  224. // uni.redirectTo({
  225. // url: '../../pages/express/express'
  226. // })
  227. // }
  228. // if (this.value1 == 1) {
  229. // uni.redirectTo({
  230. // url: '../../pages/index/index'
  231. // })
  232. // }
  233. // if (this.value1 == 2) {
  234. // uni.redirectTo({
  235. // url: '../../pages/shopping/shopping'
  236. // })
  237. // }
  238. // if (this.value1 == 3) {
  239. // uni.redirectTo({
  240. // url: '../../pages/cart/cart'
  241. // })
  242. // }
  243. // uni.setStorageSync('tabbar', e)
  244. // },
  245. checkAll() {
  246. this.$emit("allSelect");
  247. },
  248. //
  249. cancelAll(value) {
  250. if (value == "全选") {
  251. return this.all;
  252. } else if (value == "取消") {
  253. this.all = [];
  254. } else {
  255. this.all.push(this.i18n.selectall);
  256. }
  257. },
  258. click1(e) {
  259. if (e == 4) {
  260. uni.switchTab({
  261. url: "../../pages/mine/mine",
  262. });
  263. }
  264. if (e == 0) {
  265. uni.switchTab({
  266. url: "../../pages/express/express",
  267. });
  268. }
  269. if (e == 1) {
  270. uni.switchTab({
  271. url: "../../pages/index/index",
  272. });
  273. }
  274. if (e == 2) {
  275. uni.switchTab({
  276. url: "../../pages/shopping/shopping",
  277. });
  278. }
  279. if (e == 3) {
  280. uni.switchTab({
  281. url: "../../pages/cart/cart",
  282. });
  283. }
  284. // uni.setStorageSync('tabbar', e)
  285. },
  286. },
  287. // created() {},
  288. // computed: {
  289. // ...mapState(['config'])
  290. // },
  291. // watch: {
  292. // config: {
  293. // handler(val) {
  294. // if (val.report_switch == 1) {
  295. // this.list = [{
  296. // "iconPath": "/static/images/index.png",
  297. // "pagePath": "/pages/index/index",
  298. // "selectedIconPath": "/static/images/index1.png",
  299. // "text": "首页"
  300. // },
  301. // {
  302. // "iconPath": "/static/images/video.png",
  303. // "pagePath": "/pages/video/video",
  304. // "selectedIconPath": "/static/images/video1.png",
  305. // "text": "视频"
  306. // },
  307. // {
  308. // "iconPath": "/static/images/baobei.png",
  309. // "pagePath": "/pages/baobei/baobei",
  310. // "selectedIconPath": "/static/images/baobei1.png",
  311. // "text": "客户报备"
  312. // },
  313. // {
  314. // "iconPath": "/static/images/mine.png",
  315. // "pagePath": "/pages/mine/mine",
  316. // "selectedIconPath": "/static/images/mine1.png",
  317. // "text": "我的"
  318. // }
  319. // ]
  320. // }
  321. // },
  322. // deep: true
  323. // }
  324. // }
  325. };
  326. </script>
  327. <style lang="scss" scoped>
  328. .all {
  329. font-family: PingFangSC, PingFang SC;
  330. font-weight: 400;
  331. font-size: 22rpx;
  332. color: #444444;
  333. line-height: 32rpx;
  334. text-align: left;
  335. font-style: normal;
  336. }
  337. .bottom {
  338. width: 750rpx;
  339. height: 100rpx;
  340. background: #ffffff;
  341. padding: 0 24rpx;
  342. box-sizing: border-box;
  343. .dle {
  344. width: 136rpx;
  345. height: 60rpx;
  346. text-align: center;
  347. line-height: 60rpx;
  348. border-radius: 38rpx;
  349. border: 2rpx solid rgba(151, 151, 151, 1);
  350. font-size: 26rpx;
  351. color: rgba(51, 51, 51, 1);
  352. }
  353. .allweight {
  354. font-family: PingFangSC, PingFang SC;
  355. font-weight: 400;
  356. font-size: 22rpx;
  357. color: #333333;
  358. line-height: 32rpx;
  359. text-align: left;
  360. font-style: normal;
  361. }
  362. .sum {
  363. font-family: PingFangSC, PingFang SC;
  364. font-weight: 400;
  365. font-size: 22rpx;
  366. color: #333333;
  367. line-height: 32rpx;
  368. text-align: left;
  369. font-style: normal;
  370. }
  371. .summon {
  372. font-family: JDZhengHT, JDZhengHT;
  373. font-weight: 400;
  374. font-size: 24rpx;
  375. color: #ff1515;
  376. line-height: 30rpx;
  377. text-align: left;
  378. font-style: normal;
  379. }
  380. .settle {
  381. width: 176rpx;
  382. height: 68rpx;
  383. background: #f83224;
  384. border-radius: 38rpx;
  385. font-family: PingFangSC, PingFang SC;
  386. font-weight: 500;
  387. font-size: 28rpx;
  388. color: #ffffff;
  389. line-height: 68rpx;
  390. text-align: center;
  391. font-style: normal;
  392. margin-left: 20rpx;
  393. }
  394. }
  395. </style>