kj-flow.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <view>
  3. <view class="u-flex u-row-between">
  4. <view class="" style="width: 28px;height: 28px;"></view>
  5. <view class="title">{{i18n.flow}}</view>
  6. <u-icon name="close" @click="close" color="background: #333333;" size="28"></u-icon>
  7. </view>
  8. <view v-if="transportList.length>0" class="u-flex" style="margin-top: 56rpx;">
  9. <scroll-view scroll-y="true" class="left">
  10. <view v-for="(item,idx) in transportList" :key="idx" @click="changea(item,idx)"
  11. style="height: 134rpx;display: flex;flex-direction: column;align-items: center;justify-content: center;"
  12. :style="{background:idx==leftchange? '':'#F7F7F7'}">
  13. <view class="ititle" v-if="language =='zh-CN'" :style="{fontWeight:idx==leftchange?'600':''}">
  14. {{item.name_cn}}
  15. </view>
  16. <view class="ititle" v-if="language =='en-US'" :style="{fontWeight:idx==leftchange?'600':''}">
  17. {{item.name_en}}
  18. </view>
  19. <view class="ititle" v-if="language =='es-ES'" :style="{fontWeight:idx==leftchange?'600':''}">
  20. {{item.name_es}}
  21. </view>
  22. <view class="ititle" v-if="language =='it-IT'" :style="{fontWeight:idx==leftchange?'600':''}">
  23. {{item.name_ita}}
  24. </view>
  25. <view class="itime" v-if="idx==leftchange&&containerList.length>0">{{i18n.Estimatedtimeofarrival}}
  26. </view>
  27. <view class="itime" v-if="idx==leftchange&&containerList.length>0">{{estimated_arrived_date}}</view>
  28. </view>
  29. </scroll-view>
  30. <scroll-view scroll-y="true" class="right" style="margin-left: 36rpx;">
  31. <view v-for="(item,idx) in containerList" :key="idx" @click="change(item,idx)"
  32. style="display: flex;flex-direction: column;align-items: center;justify-content: center;padding: 20rpx 0 16rpx;"
  33. class="iitem">
  34. <view class="ititle u-flex u-row-between" style="width: 100%;">
  35. <view class="ititle">{{i18n.Shipmentdate}}: {{item.estimated_departed_date}}</view>
  36. <view v-if="language =='zh-CN'" style="font-size: 24rpx;
  37. color: #666666;">{{item.name_cn}}</view>
  38. <view v-if="language =='en-US'" style="font-size: 24rpx;
  39. color: #666666;">{{item.name_en}}</view>
  40. <view v-if="language =='es-ES'" style="font-size: 24rpx;
  41. color: #666666;">{{item.name_es}}</view>
  42. <view v-if="language =='it-IT'" style="font-size: 24rpx;
  43. color: #666666;">{{item.name_ita}}</view>
  44. </view>
  45. <view class="u-flex u-row-between" style="margin-top: 16rpx;width: 100%;">
  46. <view class="price">
  47. <text style='font-size="24rpx"'>¥</text>
  48. <text style='font-size="32rpx"'>{{item.unit_price}}</text>
  49. <!-- <text style='font-size="32rpx"' v-else>{{item.special_delivery_fee}}</text> -->
  50. <text style='font-size="28rpx"'>/kg</text>
  51. </view>
  52. <u-icon v-if="idx==rightchange" name="checkbox-mark" color="rgba(248, 50, 36, 1)"
  53. size="28"></u-icon>
  54. <view v-else class="" style="width: 28px;height: 28px;"></view>
  55. </view>
  56. </view>
  57. </scroll-view>
  58. </view>
  59. <view class="" v-else style="height: 300rpx;text-align: center;line-height: 300rpx;font-size: 24rpx;">
  60. {{i18n.nodata}}</view>
  61. <view class="bottom">
  62. <view class="btn" @click="enter">{{i18n.enter}}</view>
  63. </view>
  64. <!-- <view class=""></view> -->
  65. </view>
  66. </template>
  67. <script>
  68. export default {
  69. props: {
  70. weight: {
  71. typeof: Number
  72. },
  73. length: {
  74. typeof: Number
  75. },
  76. width: {
  77. typeof: Number
  78. },
  79. height: {
  80. typeof: Number
  81. },
  82. province_id: {
  83. typeof: Number
  84. },
  85. country_id: {
  86. typeof: Number
  87. },
  88. goodstype: {
  89. typeof: String,
  90. default: "normal"
  91. },
  92. leftchangea: {
  93. type: String,
  94. default: ''
  95. },
  96. rightchangea: {
  97. type: String,
  98. default: ''
  99. },
  100. typeida: {
  101. type: String,
  102. default: ''
  103. },
  104. language: {
  105. type: String,
  106. default: 'zh-CN'
  107. }
  108. },
  109. name: "kj-flow",
  110. data() {
  111. return {
  112. leftchange: 0,
  113. rightchange: 0,
  114. containerList: [],
  115. transportList: [],
  116. estimated_arrived_date: '',
  117. leftname: '',
  118. rightname: '',
  119. dateid: '',
  120. unit_price: '',
  121. // language: 'zh-CN',
  122. typeid: '',
  123. };
  124. },
  125. created() {
  126. // this.transport()
  127. },
  128. mounted() {
  129. // if (uni.getStorageSync('language') != '') {
  130. // this.language = uni.getStorageSync('language')
  131. // console.log('222222',this.language);
  132. // }
  133. },
  134. computed: {
  135. i18n() {
  136. return this.$t('index')
  137. },
  138. },
  139. methods: {
  140. //货柜列表
  141. container(id) {
  142. uni.$u.http.get('/api/container-base', {
  143. params: {
  144. is_page: 0,
  145. province_id: this.province_id,
  146. country_id: this.country_id,
  147. transport_type_id: id,
  148. type: this.goodstype,
  149. weight: this.weight,
  150. length: this.length,
  151. width: this.width,
  152. height: this.height,
  153. }
  154. }).then((res) => {
  155. this.containerList = res
  156. this.estimated_arrived_date = res[0].estimated_arrived_date
  157. this.dateid = res[0].id
  158. if (this.language == 'en-US') {
  159. this.rightname = res[0].name_en
  160. }
  161. if (this.language == 'es-ES') {
  162. this.rightname = res[0].name_es
  163. }
  164. if (this.language == 'it-IT') {
  165. this.rightname = res[0].name_ita
  166. }
  167. if (this.language == 'zh-CN') {
  168. this.rightname = res[0].name_cn
  169. }
  170. this.unit_price = res[0].unit_price
  171. }).catch(() => {
  172. })
  173. },
  174. transport() {
  175. uni.$u.http.get('/api/transport-type', {
  176. params: {
  177. province_id: this.province_id,
  178. country_id: this.country_id
  179. }
  180. }).then((res) => {
  181. this.transportList = res
  182. if (this.typeida) {
  183. console.log(this.typeida);
  184. this.leftchange = this.leftchangea
  185. this.rightchange = this.rightchangea
  186. this.container(this.typeida)
  187. this.typeid = this.transportList[0].id
  188. } else {
  189. this.container(res[0].id)
  190. }
  191. }).catch(() => {
  192. })
  193. },
  194. //左边切换
  195. changea(item, index) {
  196. this.leftchange = index
  197. this.typeid = item.id
  198. this.container(item.id)
  199. this.rightname = '',
  200. this.dateid = ''
  201. if (this.language == 'en-US') {
  202. this.leftname = item.name_en
  203. }
  204. if (this.language == 'es-ES') {
  205. this.leftname = item.name_es
  206. }
  207. if (this.language == 'it-IT') {
  208. this.leftname = item.name_ita
  209. }
  210. if (this.language == 'zh-CN') {
  211. this.leftname = item.name_cn
  212. }
  213. },
  214. //右边切换
  215. change(item, idx) {
  216. this.rightchange = idx
  217. this.dateid = item.id
  218. if (this.language == 'en-US') {
  219. this.rightname = item.name_en
  220. }
  221. if (this.language == 'es-ES') {
  222. this.rightname = item.name_es
  223. }
  224. if (this.language == 'it-IT') {
  225. this.rightname = item.name_ita
  226. }
  227. if (this.language == 'zh-CN') {
  228. this.rightname = item.name_cn
  229. }
  230. this.unit_price = item.unit_price
  231. },
  232. close() {
  233. this.$emit('close')
  234. },
  235. enter() {
  236. if (this.dateid == '') {
  237. this.$u.toast('请选择货柜')
  238. } else {
  239. this.$emit('success', {
  240. dateid: this.dateid,
  241. rightname: this.rightname,
  242. leftname: this.leftname,
  243. unit_price: this.unit_price,
  244. leftchange: this.leftchange,
  245. rightchange: this.rightchange,
  246. typeid: this.typeid
  247. })
  248. }
  249. }
  250. }
  251. }
  252. </script>
  253. <style lang="scss" scoped>
  254. .iitem {
  255. border-bottom: 2rpx solid rgba(151, 151, 151, 0.1);
  256. box-sizing: border-box;
  257. }
  258. .price {
  259. font-family: SFPro, SFPro;
  260. font-weight: 500;
  261. font-size: 24rpx;
  262. color: #F83224;
  263. line-height: 28rpx;
  264. text-align: left;
  265. font-style: normal;
  266. }
  267. .right {
  268. flex: 1;
  269. width: 474rpx;
  270. height: 642rpx;
  271. }
  272. .bottom {
  273. width: 750rpx;
  274. // height: 166rpx;
  275. background: #FFFFFF;
  276. padding: 20rpx 24rpx 0;
  277. box-sizing: border-box;
  278. }
  279. .btn {
  280. width: 702rpx;
  281. height: 84rpx;
  282. background: #F83224;
  283. border-radius: 44rpx;
  284. font-family: PingFangSC, PingFang SC;
  285. font-weight: 500;
  286. font-size: 32rpx;
  287. color: #FFFFFF;
  288. line-height: 84rpx;
  289. text-align: center;
  290. font-style: normal;
  291. }
  292. .title {
  293. font-family: PingFangSC, PingFang SC;
  294. font-weight: 500;
  295. font-size: 36rpx;
  296. color: #333333;
  297. line-height: 50rpx;
  298. text-align: left;
  299. font-style: normal;
  300. }
  301. .left {
  302. width: 212rpx;
  303. height: 642rpx;
  304. }
  305. .ititle {
  306. font-family: PingFangSC, PingFang SC;
  307. font-weight: 500;
  308. font-size: 28rpx;
  309. color: #222222;
  310. line-height: 40rpx;
  311. text-align: left;
  312. font-style: normal;
  313. }
  314. .itime {
  315. font-family: PingFangSC, PingFang SC;
  316. font-weight: 400;
  317. font-size: 20rpx;
  318. color: #333333;
  319. line-height: 28rpx;
  320. text-align: center;
  321. font-style: normal;
  322. }
  323. </style>