settlementCode.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. <template>
  2. <view class="container">
  3. <!-- Tab切换 - 平均分配宽度 -->
  4. <view class="custom-tabs">
  5. <view class="tab-item" :class="{ active: currentTab === 1 }" @click="switchTab(1)">
  6. <text class="tab-text">京东月结码</text>
  7. </view>
  8. <!-- <view class="tab-item" :class="{ active: currentTab === 2 }" @click="switchTab(2)">
  9. <text class="tab-text">顺丰月结码</text>
  10. </view> -->
  11. </view>
  12. <!-- 二维码邀请内容 -->
  13. <view class="tab-content">
  14. <!-- 店铺信息 -->
  15. <view class="store-info">
  16. <view class="store-name">月结卡号</view>
  17. <view class="store">
  18. <text class="store-address">{{settlementCode}}</text>
  19. <!-- <u-icon name="arrow-right"></u-icon> -->
  20. </view>
  21. </view>
  22. <view class="store-info" v-if="currentTab == 1">
  23. <view class="store-name">快递类型</view>
  24. <view class="store">
  25. <picker :range="expressTypes" :range-key="'label'" @change="onExpressTypeChange"
  26. :value="expressTypeIndex" :disabled="!expressTypes.length">
  27. <view class="picker-text">
  28. {{ expressTypes[expressTypeIndex]?.label || (expressTypes.length ? '请选择快递类型' : '加载中...') }}
  29. </view>
  30. </picker>
  31. <u-icon class="arrow" name='arrow-right' size="18"></u-icon>
  32. </view>
  33. </view>
  34. <!-- 二维码区域 -->
  35. <view class="qrcode-container">
  36. <view class="store-manager-content">
  37. <text class="store-manager title">请小哥扫此二维码</text>
  38. </view>
  39. <view class="store-manager-content">
  40. <text class="store-manager">警告:系统将记录所有操作,请勿违规使用</text>
  41. </view>
  42. <!-- 空出二维码位置 -->
  43. <view class="qrcode-placeholder">
  44. <!-- 这里在实际应用中会显示二维码图片 -->
  45. <image :src="qrCodeUrl"></image>
  46. </view>
  47. <view class="expiry-info" @click="getCode">
  48. <text class="text">此二维码300秒有效,点击</text>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script setup>
  55. import {
  56. ref
  57. } from 'vue'
  58. import {
  59. onLoad,
  60. onShow
  61. } from '@dcloudio/uni-app' // 导入 UniApp 的生命周期
  62. import {getQrcode,getSettlementCode} from '@/api/mine.js'
  63. // 当前选中的tab
  64. const currentTab = ref(1)
  65. const qrCodeUrl = ref('')
  66. const settlementCode = ref('')
  67. const expressTypeIndex = ref(0)
  68. const expressTypes = ref([{
  69. label:'京东快递',
  70. value:1
  71. },
  72. {
  73. label:'京东快运',
  74. value:2
  75. }]) // 当前显示的快递类型列表(已转换为 {label, value} 格式)
  76. // 快递类型
  77. const onExpressTypeChange = (e) => {
  78. expressTypeIndex.value = e.detail.value
  79. getCode()
  80. searchSettlementCode()
  81. }
  82. onLoad(() => {
  83. getCode()
  84. searchSettlementCode()
  85. })
  86. onShow(() => {
  87. })
  88. // 获取月结码
  89. const getCode = async () =>{
  90. qrCodeUrl.value = ''
  91. let params = {source:currentTab.value}
  92. if(currentTab.value == 1){
  93. params = {source:currentTab.value,type:expressTypes.value[expressTypeIndex.value].value}
  94. }
  95. let res = await getQrcode(params);
  96. console.log(res.data.qrCodeImage)
  97. qrCodeUrl.value = res.data.qrCodeImage;
  98. }
  99. const searchSettlementCode = async () =>{
  100. settlementCode.value = ''
  101. let params = {source:currentTab.value}
  102. if(currentTab.value == 1){
  103. params = {source:currentTab.value,type:expressTypes.value[expressTypeIndex.value].value}
  104. }
  105. let res = await getSettlementCode(params);
  106. console.log(res.msg)
  107. settlementCode.value = res.msg;
  108. }
  109. // 切换Tab
  110. const switchTab = (index) => {
  111. currentTab.value = index
  112. getCode()
  113. searchSettlementCode()
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. .header {
  118. padding: 44rpx 0 30rpx 0;
  119. text-align: center;
  120. background-color: #fff;
  121. border-bottom: 1rpx solid #eee;
  122. .header-title {
  123. font-size: 36rpx;
  124. font-weight: bold;
  125. color: #333;
  126. }
  127. }
  128. // 自定义Tab布局 - 平均分配
  129. .custom-tabs {
  130. display: flex;
  131. background-color: #fff;
  132. border-bottom: 1rpx solid #eee;
  133. }
  134. .tab-item {
  135. flex: 1;
  136. text-align: center;
  137. padding: 30rpx 0;
  138. position: relative;
  139. &.active {
  140. .tab-text {
  141. color: #2979ff;
  142. font-weight: bold;
  143. }
  144. &::after {
  145. content: '';
  146. position: absolute;
  147. bottom: 0;
  148. left: 50%;
  149. transform: translateX(-50%);
  150. width: 80rpx;
  151. height: 4rpx;
  152. background-color: #2979ff;
  153. border-radius: 2rpx;
  154. }
  155. }
  156. .tab-text {
  157. font-size: 32rpx;
  158. color: #666;
  159. }
  160. }
  161. // 内容区域
  162. .tab-content {
  163. padding: 20rpx;
  164. }
  165. // 店铺信息
  166. .store-info {
  167. height: 108rpx;
  168. background: #FFFFFF;
  169. border-radius: 32rpx;
  170. margin-bottom: 20rpx;
  171. padding: 0 32rpx;
  172. display: flex;
  173. justify-content: space-between;
  174. align-items: center;
  175. .store-icon {
  176. width: 80rpx;
  177. height: 80rpx;
  178. display: flex;
  179. align-items: center;
  180. justify-content: center;
  181. background: rgba(0, 137, 255, 0.1);
  182. border-radius: 16rpx 16rpx 16rpx 16rpx;
  183. flex-shrink: 0;
  184. image {
  185. width: 48rpx;
  186. height: 48rpx;
  187. }
  188. }
  189. .store {
  190. display: flex;
  191. .store-name {
  192. height: 44rpx;
  193. font-weight: 400;
  194. font-size: 28rpx;
  195. color: #333333;
  196. line-height: 44rpx;
  197. text-align: left;
  198. }
  199. .store-address {
  200. min-height: 44rpx;
  201. line-height: 44rpx;
  202. font-size: 28rpx;
  203. color: #1B64F0;
  204. text-align: left;
  205. }
  206. }
  207. }
  208. // 二维码区域
  209. .qrcode-container {
  210. background-color: #fff;
  211. border-radius: 32rpx;
  212. padding: 20rpx;
  213. text-align: center;
  214. .store-manager-content {
  215. display: flex;
  216. justify-content: center;
  217. text-align: center;
  218. image {
  219. width: 48rpx;
  220. height: 48rpx;
  221. border-radius: 48rpx;
  222. }
  223. .store-manager {
  224. height: 44rpx;
  225. font-weight: 400;
  226. font-size: 28rpx;
  227. color: #666666;
  228. line-height: 44rpx;
  229. &.title {
  230. height: 48rpx;
  231. font-weight: bold;
  232. font-size: 32rpx;
  233. color: #333333;
  234. line-height: 48rpx;
  235. }
  236. }
  237. }
  238. // 二维码占位区域
  239. .qrcode-placeholder {
  240. width: 400rpx;
  241. height: 400rpx;
  242. margin: 20rpx auto 30rpx;
  243. border-radius: 16rpx;
  244. background-color: #f5f5f5;
  245. display: flex;
  246. align-items: center;
  247. justify-content: center;
  248. /* 这里在实际应用中会显示二维码图片 */
  249. /* 暂时使用背景色占位 */
  250. image {
  251. width: 400rpx;
  252. height: 400rpx;
  253. border-radius: 16rpx;
  254. }
  255. }
  256. .expiry-info {
  257. margin: 20rpx;
  258. height: 84rpx;
  259. background: #F5F7FA;
  260. border-radius: 16rpx;
  261. font-weight: 400;
  262. font-size: 28rpx;
  263. color: #3D3D3D;
  264. line-height: 84rpx;
  265. text-align: center;
  266. .text{
  267. &::after{
  268. content: '刷新二维码';
  269. color: #1B64F0;
  270. }
  271. }
  272. }
  273. }
  274. // 按钮组
  275. .button-group {
  276. width: 100%;
  277. height: 132rpx;
  278. display: flex;
  279. justify-content: space-around;
  280. align-items: center;
  281. position: fixed;
  282. bottom: 0;
  283. padding: 0rpx 32rpx;
  284. background-color: #fff;
  285. .button {
  286. height: 88rpx;
  287. line-height: 88rpx;
  288. flex: 1;
  289. text-align: center;
  290. border-radius: 16rpx;
  291. font-size: 30rpx;
  292. font-weight: bold;
  293. &.share-button {
  294. color: #1B64F0;
  295. margin-right: 32rpx;
  296. background: rgba(0, 137, 255, 0.1);
  297. }
  298. &.save-button {
  299. background-color: #1B64F0;
  300. color: #fff;
  301. }
  302. .button-text {
  303. font-size: 30rpx;
  304. }
  305. }
  306. }
  307. // 手机号邀请表单
  308. .phone-form {
  309. background-color: #fff;
  310. border-radius: 16rpx;
  311. padding: 16rpx;
  312. .phone-title {
  313. font-size: 32rpx;
  314. font-weight: bold;
  315. color: #333;
  316. margin-bottom: 16rpx;
  317. display: block;
  318. }
  319. .phone-input-group {
  320. height: 88rpx;
  321. display: flex;
  322. border-radius: 16rpx;
  323. overflow: hidden;
  324. background-color: #F5F7FA;
  325. .country-code {
  326. width: 140rpx;
  327. padding: 24rpx;
  328. text-align: center;
  329. font-size: 28rpx;
  330. color: #333;
  331. display: flex;
  332. align-items: center;
  333. justify-content: center;
  334. border-right: 2rpx solid #e0e0e0;
  335. }
  336. .phone-input {
  337. height: 88rpx;
  338. line-height: 88rpx;
  339. flex: 1;
  340. padding: 24rpx;
  341. font-size: 28rpx;
  342. }
  343. }
  344. }
  345. .employee-item-main {
  346. display: flex;
  347. align-items: center;
  348. margin-top: 20rpx;
  349. background-color: #fff;
  350. border-radius: 32rpx;
  351. padding: 20rpx;
  352. .photo {
  353. background-color: #F5F7FA;
  354. width: 88rpx;
  355. height: 88rpx;
  356. border-radius: 80rpx;
  357. }
  358. .employee-main-info {
  359. height: 84rpx;
  360. margin-left: 20rpx;
  361. align-self: center;
  362. display: flex;
  363. flex-direction: column;
  364. justify-content: center;
  365. margin-bottom: 20rpx;
  366. flex: 1;
  367. .employee-name {
  368. height: 44rpx;
  369. line-height: 44rpx;
  370. font-size: 28rpx;
  371. font-weight: 500;
  372. color: #333333;
  373. }
  374. .employee-phone {
  375. height: 40rpx;
  376. line-height: 40rpx;
  377. font-size: 24rpx;
  378. color: #666666;
  379. }
  380. }
  381. .employee-actions {
  382. display: flex;
  383. align-items: center;
  384. height: 116rpx;
  385. background-color: #fff;
  386. border-radius: 32rpx;
  387. margin-top: 16rpx;
  388. .status-badge {
  389. display: flex;
  390. align-items: center;
  391. font-size: 26rpx;
  392. margin-right: 16rpx;
  393. .enabled {
  394. // background-color: #e6f7ff;
  395. margin-left: 16rpx;
  396. color: #1B64F0;
  397. }
  398. .disabled {
  399. // background-color: #f5f5f5;
  400. margin-left: 16rpx;
  401. color: #333333;
  402. }
  403. }
  404. .btn-view-order {
  405. height: 40rpx;
  406. font-weight: 400;
  407. font-size: 24rpx;
  408. color: #1B64F0;
  409. line-height: 40rpx;
  410. text-align: left;
  411. margin-right: 16rpx;
  412. }
  413. .dismiss-btn {
  414. width: 88rpx;
  415. height: 60rpx;
  416. line-height: 60rpx;
  417. text-align: center;
  418. background: #F52929;
  419. border-radius: 8rpx;
  420. font-size: 28rpx;
  421. color: #FFFFFF;
  422. }
  423. }
  424. }
  425. .submit-button {
  426. flex: 1;
  427. height: 88rpx;
  428. line-height: 88rpx;
  429. background-color: #1B64F0;
  430. color: #fff;
  431. text-align: center;
  432. border-radius: 16rpx;
  433. .submit-text {
  434. font-size: 32rpx;
  435. font-weight: bold;
  436. }
  437. }
  438. </style>