logisticsModel.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <Popup title="填写物流" isClose ref="popRef">
  3. <template #content>
  4. <view class="form">
  5. <view class="form_item">
  6. <view class="item_label">
  7. <trans _t="物流公司" />
  8. </view>
  9. <view class="item_value">
  10. <Input
  11. :placeholder="t('请填写物流公司')"
  12. border="surround"
  13. v-model="form.express_name"
  14. />
  15. </view>
  16. </view>
  17. <view class="form_item">
  18. <view class="item_label">
  19. <trans _t="快递单号" />
  20. </view>
  21. <view class="item_value">
  22. <Input
  23. :placeholder="t('请填写快递单号')"
  24. border="surround"
  25. v-model="form.express_no"
  26. />
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <!-- footer -->
  32. <template #footer>
  33. <view class="footer">
  34. <view class="submit_btn submit_close" @click="close">
  35. <trans _t="取消" />
  36. </view>
  37. <view class="submit_btn" @click="submit">
  38. <trans _t="确认" />
  39. </view>
  40. </view>
  41. </template>
  42. </Popup>
  43. </template>
  44. <script setup>
  45. import { computed, ref, reactive, nextTick } from "vue";
  46. import Popup from "@/components/popup.vue";
  47. import { Toast, Moneyhtml } from "@/utils";
  48. import { t } from "@/locale";
  49. import { useSystemStore } from "@/store";
  50. import Input from "@/components/input";
  51. import { SHOP_BUYBACK_EXPRESS } from "@/api";
  52. const emit = defineEmits(["submit", "open", "close"]);
  53. const popRef = ref(null);
  54. const form = reactive({
  55. id: "",
  56. express_name: "",
  57. express_no: "",
  58. });
  59. const open = (id = "") => {
  60. form.id = id;
  61. emit("open");
  62. popRef.value && popRef.value.open();
  63. };
  64. const close = () => {
  65. emit("close");
  66. popRef.value && popRef.value.close();
  67. };
  68. const submit = async () => {
  69. if (!form.express_name) return Toast(t("请填写物流公司"));
  70. if (!form.express_no) return Toast(t("请填写快递单号"));
  71. try {
  72. let res = await SHOP_BUYBACK_EXPRESS(form);
  73. close();
  74. Toast(res.msg).then(() => {
  75. TimeOut(() => {
  76. close();
  77. emit("submit");
  78. });
  79. });
  80. Toast(res.msg);
  81. } catch (error) {
  82. Toast(error.msg);
  83. }
  84. };
  85. defineExpose({ open, close });
  86. </script>
  87. <style lang="less" scoped>
  88. @import url("@/style.less");
  89. .form {
  90. width: 100%;
  91. &_item {
  92. width: 100%;
  93. margin-top: 24rpx;
  94. &:first-child {
  95. margin-top: 0;
  96. }
  97. .item_label {
  98. font-weight: 700;
  99. color: var(--text);
  100. .size(28rpx);
  101. line-height: 60rpx;
  102. white-space: nowrap;
  103. padding-right: 24rpx;
  104. height: 64rpx;
  105. width: fit-content;
  106. position: relative;
  107. &::before {
  108. content: "*";
  109. color: #f56c6c;
  110. margin-right: 8rpx;
  111. }
  112. }
  113. ._required {
  114. &::before {
  115. content: "";
  116. margin-right: 0rpx;
  117. }
  118. }
  119. .item_value {
  120. column-gap: 24rpx;
  121. flex: 1;
  122. /deep/ .u-input {
  123. border-radius: 16rpx;
  124. padding: 0 24rpx !important;
  125. background-color: var(--bg);
  126. .u-input__content {
  127. display: unset;
  128. }
  129. }
  130. }
  131. }
  132. .tips {
  133. color: var(--text-01);
  134. .size(24rpx);
  135. margin: 24rpx 0;
  136. }
  137. .total {
  138. text-align: right;
  139. color: var(--black);
  140. .size(28rpx);
  141. .amount {
  142. color: var(--red);
  143. font-weight: 700;
  144. margin-left: 2rpx;
  145. }
  146. }
  147. }
  148. .footer {
  149. .hor(space-between);
  150. column-gap: 20rpx;
  151. .submit_btn {
  152. height: 76rpx;
  153. padding: 16rpx 100rpx;
  154. background-color: var(--black);
  155. color: var(--light);
  156. .flex_center();
  157. border-radius: 16rpx;
  158. .size(24rpx);
  159. &.submit_close {
  160. background-color: var(--bg);
  161. border: 1rpx solid var(--black);
  162. color: var(--black);
  163. }
  164. }
  165. }
  166. </style>