nextLogistics.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <view class="list">
  3. <u-popup :safeAreaInsetTop="false" :show="nextLogisticsShow" @close="$emit('closeLogistics')" mode="bottom"
  4. closeIconPos="top-right" round="28" bgColor="#F4F4F4">
  5. <view style="padding: 40rpx 28rpx; box-sizing: border-box; position: relative">
  6. <view class="u-flex u-row-between">
  7. <view class="" style="width: 28px; height: 28px"></view>
  8. <view class="poptitle">
  9. {{ i18n.flow }}
  10. </view>
  11. <u-icon name="close" @click="$emit('closeLogistics')" color="background: #333333;"
  12. size="28"></u-icon>
  13. </view>
  14. <scroll-view :scroll-y="true" style="500rpx">
  15. <view class="transport" style="margin-top: 32rpx" @click="activea(item, idx)"
  16. v-for="(item, idx) in containerList" v-if="item.sum != 0">
  17. <view class="u-flex u-row-between">
  18. <text class="yundate">{{ i18n.Shipmentdate }} {{ item.end_date }}</text>
  19. <image v-if="datechan == idx" src="../../../static/mine/330.png"
  20. style="width: 36rpx; height: 36rpx" mode=""></image>
  21. <image v-else src="../../../static/mine/327.png" style="width: 36rpx; height: 36rpx"
  22. mode=""></image>
  23. </view>
  24. <view class="u-flex u-row-between" style="margin-top: 28rpx">
  25. <view class="chest">
  26. <text>{{ item.name_cn }}</text>
  27. <text v-if="language == 'en-US'">{{ item.name_en }}</text>
  28. <text v-if="language == 'es-ES'">{{ item.name_es }}</text>
  29. <text v-if="language == 'it-IT'">{{ item.name_ita }}</text>
  30. <text style="margin: 0 16rpx">|</text>
  31. <text>{{ i18n.Estimatedtimeofarrival }}{{ item.transport_days
  32. }}{{ i18n.Workingday }}</text>
  33. </view>
  34. <view class="mone">
  35. <text>¥</text>
  36. <text style="font-size: 48rpx; font-weight: 600">{{
  37. item.sum
  38. }}</text>
  39. </view>
  40. </view>
  41. </view>
  42. </scroll-view>
  43. <view class="" style="height: 166rpx"></view>
  44. <view class="enbottom u-flex u-row-between">
  45. <view class="cancel" @click="$emit('closeLogistics')">{{
  46. i18n.Cancel
  47. }}</view>
  48. <view class="confirm" @click="confirm">{{ i18n.enter }}</view>
  49. </view>
  50. </view>
  51. </u-popup>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. name: "nextLogistics",
  57. props: {
  58. nextLogisticsShow: {
  59. typeof: Boolean,
  60. default: false,
  61. },
  62. language: {
  63. typeof: String,
  64. default: "",
  65. },
  66. goodinfo: {
  67. typeof: Object,
  68. default: () => {
  69. return {};
  70. },
  71. },
  72. goodsValue: {
  73. typeof: Number,
  74. default: 0,
  75. },
  76. //商品规格价格
  77. specificationsPrice: {
  78. typeof: String,
  79. default: "",
  80. },
  81. //多商品
  82. goodsArr: {
  83. typeof: Object,
  84. default: () => {
  85. return {};
  86. },
  87. },
  88. addinfo: {
  89. typeof: Object,
  90. default: () => {
  91. return {};
  92. },
  93. },
  94. },
  95. computed: {
  96. i18n() {
  97. return this.$t("index");
  98. },
  99. },
  100. data() {
  101. return {
  102. containerList: [], //货柜列表
  103. unit_price: "",
  104. recommend_weight: "",
  105. containname: "",
  106. sum: "", //运费
  107. containid: "", //货柜id
  108. datechan: "", //当前选中的货柜列表下标
  109. max_weight: "", //推荐重量。当满足当前重量,减少价格
  110. min_weight: "",
  111. unit_fee: "", //满减价格
  112. unchangedFreight: "", //基础运费,不会变
  113. unchangedUnit_price: "",
  114. goodsWeight: 0,
  115. };
  116. },
  117. watch: {
  118. //打开窗口,获取货柜
  119. nextLogisticsShow(newVal) {
  120. if (newVal) {
  121. uni.$u.http
  122. .get("/api/container-base", {
  123. params: {
  124. is_page: 0,
  125. province_id: this.goodinfo.province_id,
  126. country_id:this.goodinfo.country_id,
  127. transport_type_id: this.goodinfo.transport_type_id,
  128. weight: Number(this.goodinfo.weight),
  129. length: Number(this.goodinfo.length), // 是 String 长
  130. width: this.goodinfo.width, // 是 String 宽
  131. height: this.goodinfo.height, // 是 String 高
  132. cart_id: "",
  133. goods_arr: JSON.stringify(this.goodsArr),
  134. },
  135. })
  136. .then((res) => {
  137. res.forEach((item) => {
  138. this.containerList = []
  139. if (item.sum != 0) {
  140. this.containerList.push(item);
  141. }
  142. });
  143. if (this.goodinfo.is_shipping == 0) {
  144. this.sum = 0;
  145. this.unchangedFreight = 0;
  146. } else {
  147. this.sum = this.containerList[0].sum;
  148. this.unchangedFreight = this.containerList[0].sum;
  149. }
  150. this.unit_price = this.containerList[0].unit_price;
  151. this.unchangedUnit_price = this.containerList[0].unit_price;
  152. this.recommend_weight = this.containerList[0].recommend_weight;
  153. this.containid = this.containerList[0].id;
  154. this.goodsWeight = this.containerList[0].weight_total;
  155. console.log(this.language);
  156. if (this.language == "zh-CN") {
  157. this.containname = this.containerList[0].name_cn;
  158. }
  159. if (this.language == "en-US") {
  160. this.containname = this.containerList[0].name_en;
  161. }
  162. if (this.language == "es-ES") {
  163. this.containname = this.containerList[0].name_es;
  164. }
  165. if (this.language == "it-IT") {
  166. this.containname = this.containerList[0].name_ita;
  167. }
  168. })
  169. .catch(() => {});
  170. }
  171. },
  172. },
  173. methods: {
  174. //运费满减
  175. async config() {
  176. var that = this;
  177. await uni.$u.http
  178. .get("/api/config", {
  179. params: {
  180. module: "free_shipping",
  181. },
  182. })
  183. .then((res) => {
  184. let goodsum = "";
  185. goodsum = Number(that.specificationsPrice);
  186. if (goodsum > res.free_shipping) {
  187. that.sum = 0;
  188. that.unit_price = 0;
  189. } else {
  190. this.sum = this.unchangedFreight;
  191. this.unit_price = this.unchangedUnit_price;
  192. }
  193. })
  194. .catch(() => {});
  195. },
  196. //推荐重量
  197. async recommendweight() {
  198. await uni.$u.http
  199. .get("/api/express-order/recommend-container", {
  200. params: {
  201. container_id: this.containid,
  202. type: "normal",
  203. },
  204. })
  205. .then((res) => {
  206. this.max_weight = res.max_weight;
  207. this.min_weight = res.min_weight;
  208. this.unit_fee = res.unit_fee;
  209. })
  210. .catch(() => {});
  211. },
  212. //下单前计算数据
  213. //确定选择货柜
  214. confirm() {
  215. this.recommendweight();
  216. this.config();
  217. //异步跳转
  218. const timer = setTimeout(() => {
  219. let data = {
  220. type: "second",
  221. containname: this.containname,
  222. containid: this.containid,
  223. recommend_weight: this.recommend_weight,
  224. unit_price: this.unit_price,
  225. sum: this.sum,
  226. max_weight: this.max_weight,
  227. min_weight: this.min_weight,
  228. unit_fee: this.unit_fee,
  229. unchangedFreight: this.unchangedFreight,
  230. unchangedUnit_price: this.unchangedUnit_price,
  231. goodsWeight: this.goodsWeight,
  232. };
  233. console.log(data);
  234. this.$emit("closeLogistics", data);
  235. this.$emit("calculate");
  236. clearTimeout(timer);
  237. }, 200);
  238. },
  239. activea(item, idx) {
  240. this.datechan = idx;
  241. this.sum = item.sum;
  242. this.unchangedFreight = item.sum;
  243. this.unit_price = item.unit_price;
  244. this.recommend_weight = item.recommend_weight;
  245. this.containid = item.id;
  246. this.containname = item.name_cn; //等待后续更改language删除掉
  247. if (this.language == "zh-CN") {
  248. this.containname = item.name_cn;
  249. }
  250. if (this.language == "en-US") {
  251. this.containname = item.name_en;
  252. }
  253. if (this.language == "es-ES") {
  254. this.containname = item.name_es;
  255. }
  256. if (this.language == "it-IT") {
  257. this.containname = item.name_ita;
  258. }
  259. },
  260. },
  261. };
  262. </script>
  263. <style scoped lang="scss">
  264. .poptitle {
  265. width: 142rpx;
  266. height: 50rpx;
  267. font-family: PingFangSC, PingFang SC;
  268. font-weight: 600;
  269. font-size: 36rpx;
  270. color: #333333;
  271. text-align: center;
  272. width: 100%;
  273. }
  274. .transport {
  275. width: 702rpx;
  276. height: 164rpx;
  277. background: #ffffff;
  278. border-radius: 12rpx;
  279. padding: 24rpx 20rpx;
  280. box-sizing: border-box;
  281. }
  282. .yundate {
  283. font-family: PingFangSC, PingFang SC;
  284. font-weight: 550;
  285. font-size: 32rpx;
  286. color: #333333;
  287. line-height: 44rpx;
  288. text-align: left;
  289. font-style: normal;
  290. }
  291. .chest {
  292. font-family: SFPro, SFPro;
  293. font-weight: 400;
  294. font-size: 24rpx;
  295. color: #555555;
  296. line-height: 28rpx;
  297. text-align: left;
  298. font-style: normal;
  299. }
  300. .mone {
  301. font-family: JDZhengHT, JDZhengHT;
  302. font-weight: 400;
  303. font-size: 26rpx;
  304. color: #f83224;
  305. line-height: 32rpx;
  306. text-align: left;
  307. font-style: normal;
  308. }
  309. .enbottom {
  310. width: 750rpx;
  311. height: 166rpx;
  312. background: #ffffff;
  313. position: absolute;
  314. left: 0rpx;
  315. bottom: 0;
  316. padding: 0 24rpx;
  317. box-sizing: border-box;
  318. .confirm {
  319. width: 398rpx;
  320. height: 84rpx;
  321. background: #f83224;
  322. border-radius: 42rpx;
  323. text-align: center;
  324. font-family: PingFangSC, PingFang SC;
  325. font-weight: 500;
  326. font-size: 32rpx;
  327. color: #ffffff;
  328. line-height: 84rpx;
  329. text-align: center;
  330. font-style: normal;
  331. }
  332. .cancel {
  333. width: 280rpx;
  334. height: 84rpx;
  335. border-radius: 42rpx;
  336. border: 2rpx solid rgba(151, 151, 151, 0.3);
  337. font-family: PingFangSC, PingFang SC;
  338. font-weight: 400;
  339. font-size: 32rpx;
  340. color: #444444;
  341. line-height: 84rpx;
  342. text-align: center;
  343. font-style: normal;
  344. }
  345. }
  346. </style>