diff --git a/package-lock.json b/package-lock.json index 57a60c4..4e7fbe7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.0", "dependencies": { "@vant/area-data": "^2.1.0", + "@zxing/library": "^0.21.3", "image-conversion": "^2.1.1", "pinia": "^3.0.4", "postcss-px-to-viewport-8-plugin": "^1.2.5", @@ -629,6 +630,28 @@ "integrity": "sha512-ksNyrmRQzWJJ8n3cRDuSF7zNNontuJg1YHnmWRJd2AMu8Ij2bqwiiri2lH5rHtYPZjj4STkNcgcmiQqlOjiYGg==", "license": "MIT" }, + "node_modules/@zxing/library": { + "version": "0.21.3", + "resolved": "https://registry.npmmirror.com/@zxing/library/-/library-0.21.3.tgz", + "integrity": "sha512-hZHqFe2JyH/ZxviJZosZjV+2s6EDSY0O24R+FQmlWZBZXP9IqMo7S3nb3+2LBWxodJQkSurdQGnqE7KXqrYgow==", + "license": "MIT", + "dependencies": { + "ts-custom-error": "^3.2.1" + }, + "engines": { + "node": ">= 10.4.0" + }, + "optionalDependencies": { + "@zxing/text-encoding": "~0.9.0" + } + }, + "node_modules/@zxing/text-encoding": { + "version": "0.9.0", + "resolved": "https://registry.npmmirror.com/@zxing/text-encoding/-/text-encoding-0.9.0.tgz", + "integrity": "sha512-U/4aVJ2mxI0aDNI8Uq0wEhMgY+u4CNtEb0om3+y3+niDAsoTCOB33UF0sxpzqzdqXLqmvc+vZyAt4O8pPdfkwA==", + "license": "(Unlicense OR Apache-2.0)", + "optional": true + }, "node_modules/acorn": { "version": "8.16.0", "resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.16.0.tgz", @@ -1629,6 +1652,15 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, + "node_modules/ts-custom-error": { + "version": "3.3.1", + "resolved": "https://registry.npmmirror.com/ts-custom-error/-/ts-custom-error-3.3.1.tgz", + "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz", diff --git a/package.json b/package.json index ef69f68..ff60889 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ }, "dependencies": { "@vant/area-data": "^2.1.0", + "@zxing/library": "^0.21.3", "image-conversion": "^2.1.1", "pinia": "^3.0.4", "postcss-px-to-viewport-8-plugin": "^1.2.5", diff --git a/public/img/Agriculture_Active.png b/public/img/Agriculture_Active.png deleted file mode 100644 index 3977c95..0000000 Binary files a/public/img/Agriculture_Active.png and /dev/null differ diff --git a/public/img/Agriculture_Inactive.png b/public/img/Agriculture_Inactive.png deleted file mode 100644 index 1ac4924..0000000 Binary files a/public/img/Agriculture_Inactive.png and /dev/null differ diff --git a/public/img/AliPay.png b/public/img/AliPay.png deleted file mode 100644 index 527b0e1..0000000 Binary files a/public/img/AliPay.png and /dev/null differ diff --git a/public/img/baogong.png b/public/img/baogong.png deleted file mode 100644 index 3045eb9..0000000 Binary files a/public/img/baogong.png and /dev/null differ diff --git a/public/img/co-1.png b/public/img/co-1.png deleted file mode 100644 index 04b31d1..0000000 Binary files a/public/img/co-1.png and /dev/null differ diff --git a/public/img/co-2.png b/public/img/co-2.png deleted file mode 100644 index e1252f4..0000000 Binary files a/public/img/co-2.png and /dev/null differ diff --git a/public/img/co-3.png b/public/img/co-3.png deleted file mode 100644 index 297b787..0000000 Binary files a/public/img/co-3.png and /dev/null differ diff --git a/public/img/co.png b/public/img/co.png deleted file mode 100644 index 5132bc9..0000000 Binary files a/public/img/co.png and /dev/null differ diff --git a/public/img/cocreateing.png b/public/img/cocreateing.png deleted file mode 100644 index 6f85229..0000000 Binary files a/public/img/cocreateing.png and /dev/null differ diff --git a/public/img/copy-b.png b/public/img/copy-b.png deleted file mode 100644 index 73f775e..0000000 Binary files a/public/img/copy-b.png and /dev/null differ diff --git a/public/img/cv-i2.png b/public/img/cv-i2.png deleted file mode 100644 index e1a8cb9..0000000 Binary files a/public/img/cv-i2.png and /dev/null differ diff --git a/public/img/cv-i3.png b/public/img/cv-i3.png deleted file mode 100644 index d9662b2..0000000 Binary files a/public/img/cv-i3.png and /dev/null differ diff --git a/public/img/cv-t.png b/public/img/cv-t.png deleted file mode 100644 index 38f50f1..0000000 Binary files a/public/img/cv-t.png and /dev/null differ diff --git a/public/img/cv_bg.jpg b/public/img/cv_bg.jpg deleted file mode 100644 index 85071d0..0000000 Binary files a/public/img/cv_bg.jpg and /dev/null differ diff --git a/public/img/explain.png b/public/img/explain.png deleted file mode 100644 index 887ea2b..0000000 Binary files a/public/img/explain.png and /dev/null differ diff --git a/public/img/goods-1.png b/public/img/goods-1.png deleted file mode 100644 index 9f411aa..0000000 Binary files a/public/img/goods-1.png and /dev/null differ diff --git a/public/img/goods-2.png b/public/img/goods-2.png deleted file mode 100644 index d59f48f..0000000 Binary files a/public/img/goods-2.png and /dev/null differ diff --git a/public/img/hg.png b/public/img/hg.png deleted file mode 100644 index 1030de5..0000000 Binary files a/public/img/hg.png and /dev/null differ diff --git a/public/img/login-btn.png b/public/img/login-btn.png deleted file mode 100644 index 432f994..0000000 Binary files a/public/img/login-btn.png and /dev/null differ diff --git a/public/img/logo-lr.png b/public/img/logo-lr.png new file mode 100644 index 0000000..ecbb1d9 Binary files /dev/null and b/public/img/logo-lr.png differ diff --git a/public/img/mall-banner.png b/public/img/mall-banner.png deleted file mode 100644 index d0f4273..0000000 Binary files a/public/img/mall-banner.png and /dev/null differ diff --git a/public/img/mallDetail-bg.jpg b/public/img/mallDetail-bg.jpg new file mode 100644 index 0000000..96a9ec9 Binary files /dev/null and b/public/img/mallDetail-bg.jpg differ diff --git a/public/img/mallDetail-bg.png b/public/img/mallDetail-bg.png deleted file mode 100644 index 8ba3c18..0000000 Binary files a/public/img/mallDetail-bg.png and /dev/null differ diff --git a/public/img/mallDetail-i0.png b/public/img/mallDetail-i0.png index 21c6915..026b554 100644 Binary files a/public/img/mallDetail-i0.png and b/public/img/mallDetail-i0.png differ diff --git a/public/img/mallDetail-i1.png b/public/img/mallDetail-i1.png index 21c6915..573bc88 100644 Binary files a/public/img/mallDetail-i1.png and b/public/img/mallDetail-i1.png differ diff --git a/public/img/mallDetail-i3.png b/public/img/mallDetail-i3.png index 5f6fc56..7e555c6 100644 Binary files a/public/img/mallDetail-i3.png and b/public/img/mallDetail-i3.png differ diff --git a/public/img/mallDetail-i4.png b/public/img/mallDetail-i4.png index 2f48abd..088125d 100644 Binary files a/public/img/mallDetail-i4.png and b/public/img/mallDetail-i4.png differ diff --git a/public/img/mall_i27.png b/public/img/mall_i27.png deleted file mode 100644 index 604789a..0000000 Binary files a/public/img/mall_i27.png and /dev/null differ diff --git a/public/img/mall_i28.png b/public/img/mall_i28.png deleted file mode 100644 index 17256d9..0000000 Binary files a/public/img/mall_i28.png and /dev/null differ diff --git a/public/img/mall_i31.png b/public/img/mall_i31.png deleted file mode 100644 index 5f4c7a1..0000000 Binary files a/public/img/mall_i31.png and /dev/null differ diff --git a/public/img/mall_i32.png b/public/img/mall_i32.png deleted file mode 100644 index d520c3e..0000000 Binary files a/public/img/mall_i32.png and /dev/null differ diff --git a/public/img/mall_i33.png b/public/img/mall_i33.png deleted file mode 100644 index 7a5d38c..0000000 Binary files a/public/img/mall_i33.png and /dev/null differ diff --git a/public/img/mall_i34.png b/public/img/mall_i34.png deleted file mode 100644 index 04d551c..0000000 Binary files a/public/img/mall_i34.png and /dev/null differ diff --git a/public/img/mc-i1.png b/public/img/mc-i1.png deleted file mode 100644 index 2a4eaac..0000000 Binary files a/public/img/mc-i1.png and /dev/null differ diff --git a/public/img/mc-i2.png b/public/img/mc-i2.png deleted file mode 100644 index 9b926d8..0000000 Binary files a/public/img/mc-i2.png and /dev/null differ diff --git a/public/img/mc-i3.png b/public/img/mc-i3.png deleted file mode 100644 index 704b942..0000000 Binary files a/public/img/mc-i3.png and /dev/null differ diff --git a/public/img/mc-i4.png b/public/img/mc-i4.png deleted file mode 100644 index 8df5966..0000000 Binary files a/public/img/mc-i4.png and /dev/null differ diff --git a/public/img/money.png b/public/img/money.png deleted file mode 100644 index 863f761..0000000 Binary files a/public/img/money.png and /dev/null differ diff --git a/public/img/more.png b/public/img/more.png deleted file mode 100644 index cb2de46..0000000 Binary files a/public/img/more.png and /dev/null differ diff --git a/public/img/my-i10.png b/public/img/my-i10.png deleted file mode 100644 index 8f2476f..0000000 Binary files a/public/img/my-i10.png and /dev/null differ diff --git a/public/img/my-i11.png b/public/img/my-i11.png deleted file mode 100644 index 7c417f7..0000000 Binary files a/public/img/my-i11.png and /dev/null differ diff --git a/public/img/my-i12.png b/public/img/my-i12.png deleted file mode 100644 index 022a240..0000000 Binary files a/public/img/my-i12.png and /dev/null differ diff --git a/public/img/my-i13.png b/public/img/my-i13.png deleted file mode 100644 index e60859f..0000000 Binary files a/public/img/my-i13.png and /dev/null differ diff --git a/public/img/my-i4.png b/public/img/my-i4.png deleted file mode 100644 index 1cd2ac6..0000000 Binary files a/public/img/my-i4.png and /dev/null differ diff --git a/public/img/my-i5.png b/public/img/my-i5.png deleted file mode 100644 index ce3c8b9..0000000 Binary files a/public/img/my-i5.png and /dev/null differ diff --git a/public/img/my-i6.png b/public/img/my-i6.png deleted file mode 100644 index 5041116..0000000 Binary files a/public/img/my-i6.png and /dev/null differ diff --git a/public/img/my-i7.png b/public/img/my-i7.png deleted file mode 100644 index 0e634ec..0000000 Binary files a/public/img/my-i7.png and /dev/null differ diff --git a/public/img/my-i8.png b/public/img/my-i8.png deleted file mode 100644 index 89a82c1..0000000 Binary files a/public/img/my-i8.png and /dev/null differ diff --git a/public/img/my-i9.png b/public/img/my-i9.png deleted file mode 100644 index 0c0c95f..0000000 Binary files a/public/img/my-i9.png and /dev/null differ diff --git a/public/img/orderCopy.png b/public/img/orderCopy.png deleted file mode 100644 index 74f83bc..0000000 Binary files a/public/img/orderCopy.png and /dev/null differ diff --git a/public/img/price_bg.png b/public/img/price_bg.png deleted file mode 100644 index 092f8f7..0000000 Binary files a/public/img/price_bg.png and /dev/null differ diff --git a/public/img/remark-i1.png b/public/img/remark-i1.png deleted file mode 100644 index 3bf787a..0000000 Binary files a/public/img/remark-i1.png and /dev/null differ diff --git a/public/img/remark-i2.png b/public/img/remark-i2.png deleted file mode 100644 index 81ea9f6..0000000 Binary files a/public/img/remark-i2.png and /dev/null differ diff --git a/public/img/remark-i3.png b/public/img/remark-i3.png deleted file mode 100644 index aabc495..0000000 Binary files a/public/img/remark-i3.png and /dev/null differ diff --git a/public/img/remark-i4.png b/public/img/remark-i4.png deleted file mode 100644 index 43f5284..0000000 Binary files a/public/img/remark-i4.png and /dev/null differ diff --git a/public/img/reset-bg.jpg b/public/img/reset-bg.jpg deleted file mode 100644 index ec4af03..0000000 Binary files a/public/img/reset-bg.jpg and /dev/null differ diff --git a/public/img/service-icon.png b/public/img/service-icon.png deleted file mode 100644 index 017a185..0000000 Binary files a/public/img/service-icon.png and /dev/null differ diff --git a/public/img/set-i5.png b/public/img/set-i5.png deleted file mode 100644 index aca7890..0000000 Binary files a/public/img/set-i5.png and /dev/null differ diff --git a/public/img/sp.png b/public/img/sp.png deleted file mode 100644 index c69b58d..0000000 Binary files a/public/img/sp.png and /dev/null differ diff --git a/public/img/toGift.png b/public/img/toGift.png deleted file mode 100644 index f707483..0000000 Binary files a/public/img/toGift.png and /dev/null differ diff --git a/public/img/toTrade-1.png b/public/img/toTrade-1.png deleted file mode 100644 index 9f39bbe..0000000 Binary files a/public/img/toTrade-1.png and /dev/null differ diff --git a/public/img/toTrade-2.png b/public/img/toTrade-2.png deleted file mode 100644 index dbf8513..0000000 Binary files a/public/img/toTrade-2.png and /dev/null differ diff --git a/public/img/transfer.png b/public/img/transfer.png deleted file mode 100644 index 956346d..0000000 Binary files a/public/img/transfer.png and /dev/null differ diff --git a/public/img/vd.png b/public/img/vd.png deleted file mode 100644 index ac924da..0000000 Binary files a/public/img/vd.png and /dev/null differ diff --git a/public/img/video_bg.png b/public/img/video_bg.png deleted file mode 100644 index 375a5c2..0000000 Binary files a/public/img/video_bg.png and /dev/null differ diff --git a/public/img/voucher-bg.png b/public/img/voucher-bg.png deleted file mode 100644 index a1d8a48..0000000 Binary files a/public/img/voucher-bg.png and /dev/null differ diff --git a/public/img/voucher-c.png b/public/img/voucher-c.png deleted file mode 100644 index bb77c11..0000000 Binary files a/public/img/voucher-c.png and /dev/null differ diff --git a/src/api/http.js b/src/api/http.js index bd7e01f..0afda7c 100644 --- a/src/api/http.js +++ b/src/api/http.js @@ -16,9 +16,9 @@ const ERR_CODE = { SERVER_ERROR: 500, }; -function getHeaders() { +function getHeaders(contentType = 'application/json') { const headers = { - 'Content-Type': 'application/json', + 'Content-Type': contentType, }; const token = localStorage.getItem('token'); if (token) { @@ -137,6 +137,26 @@ export const post = (url, data, timeout = DEFAULT_TIMEOUT) => request(url, data, export const put = (url, data, timeout = DEFAULT_TIMEOUT) => request(url, data, 'PUT', timeout); export const del = (url, data, timeout = DEFAULT_TIMEOUT) => request(url, data, 'DELETE', timeout); +/** + * POST FormData 请求 + * @param {string} url - 请求路径 + * @param {FormData} formData - FormData 对象 + * @param {number} timeout - 超时时间 ms + * @returns {Promise} + */ +export function postForm(url, formData, timeout = DEFAULT_TIMEOUT) { + const headers = {}; + const token = localStorage.getItem('token'); + if (token) { + headers['Authorization'] = `Bearer ${token}`; + } + return fetchWithTimeout(BASE_URL + url, { + method: 'POST', + headers, + body: formData, + }, timeout).then(handleResponse).catch(handleError); +} + /** * 上传文件 * @param {string} url - 请求路径 @@ -175,4 +195,4 @@ export function upload(url, files, timeout = 30000) { .catch(handleError); } -export default { get, post, put, del, upload, request }; \ No newline at end of file +export default { get, post, put, del, upload, postForm, request }; \ No newline at end of file diff --git a/src/components/BaseList.vue b/src/components/BaseList.vue index 1f99b08..37c1473 100644 --- a/src/components/BaseList.vue +++ b/src/components/BaseList.vue @@ -1,13 +1,17 @@ @@ -29,6 +33,7 @@ export default { list: [], page: 1, requestId: 0, + observer: null, } }, emits: ['update:list', 'load', 'refresh'], @@ -46,9 +51,32 @@ export default { } }, mounted() { - this.loadMore() + this.$nextTick(() => { + this.observer = new IntersectionObserver((entries) => { + if (entries[0].isIntersecting && !this.loading && !this.finished) { + this.loadMore() + } + }, { rootMargin: '100px' }) + if (this.$refs.sentinel) { + this.observer.observe(this.$refs.sentinel) + } + }) + window.addEventListener('scroll', this.onWindowScroll) + }, + beforeUnmount() { + this.observer?.disconnect() + window.removeEventListener('scroll', this.onWindowScroll) }, methods: { + onWindowScroll() { + if (this.finished || this.loading) return + const el = this.$refs.sentinel + if (!el) return + const rect = el.getBoundingClientRect() + if (rect.top < window.innerHeight) { + this.loadMore() + } + }, loadMore() { if (this.loading) return const currentRequestId = this.requestId @@ -58,7 +86,7 @@ export default { .then(res => { if (currentRequestId !== this.requestId) return const data = this.parseData(res) - console.log(data); + // console.log(data); const safeData = data || [] if (this.page === 1) { @@ -86,7 +114,6 @@ export default { this._skipWatch = true this.loadMore() this.$emit('refresh', this.list) - // 同步重置,不再用 $nextTick this._skipWatch = false }, }, diff --git a/src/components/BasePage.vue b/src/components/BasePage.vue index 90753f7..e7c5d70 100644 --- a/src/components/BasePage.vue +++ b/src/components/BasePage.vue @@ -1,6 +1,6 @@ @@ -38,7 +39,19 @@ \ No newline at end of file diff --git a/src/views/Merchant/MerchantIncome.vue b/src/views/Merchant/MerchantIncome.vue index 86b3a75..efd52e8 100644 --- a/src/views/Merchant/MerchantIncome.vue +++ b/src/views/Merchant/MerchantIncome.vue @@ -10,20 +10,20 @@ - ¥{{ data.total?.Balance.toFixed(2) }} + ¥{{ data.total.income?.toFixed(2) }}
昨日收入: - ¥{{ data.total?.YesterdayAmount.toFixed(2) }} + ¥{{ data.total.incomeyestoday?.toFixed(2) }}
提现中: - ¥{{ data.total?.CashAmount.toFixed(2) }} + ¥{{ data.total?.withdrawing?.toFixed(2) }}
@@ -51,27 +51,30 @@
当月收款: - ¥{{ data.total?.MonthBalance?.toFixed(2) }} + ¥{{ data.total?.incomemonth?.toFixed(2) }}
-
-
- {{ type[item.RecordSource] }} -

剩余:{{ item.CurValue }}

- {{ item.OpeType > 0 ? - '+' : '-' }}{{ item.RecordValue?.toFixed(2) }} + +
@@ -83,7 +86,7 @@ -
+
@@ -91,41 +94,57 @@ export default { name: 'MerchantIncome', mounted() { + this.init(); }, data() { return { data: { total: { - Balance: 12868.50, - YesterdayAmount: 568.00, - CashAmount: 2000.00, - MonthBalance: 8650.00 - }, - Term: '营业收入说明:商家通过平台交易获得的收入,每日自动转入绑定银行账户。' + balance: 0, + incometoday: 0, + incomeyestoday: 0, + incomemonth: 0, + withdrawing: 0 + } }, - records: [ - { RecordSource: 'sale', OpeType: 1, RecordValue: 128.00, CurValue: 12868.50, TradeCode: 'T20260418001', CTime: '2024-04-18 10:30:00' }, - { RecordSource: 'sale', OpeType: 1, RecordValue: 256.00, CurValue: 12868.50, TradeCode: 'T20260418002', CTime: '2024-04-18 11:20:00' }, - { RecordSource: 'cashout', OpeType: 0, RecordValue: 500.00, CurValue: 12868.50, TradeCode: 'T20260417001', CTime: '2024-04-17 18:00:00' }, - { RecordSource: 'sale', OpeType: 1, RecordValue: 89.00, CurValue: 12868.50, TradeCode: 'T20260417002', CTime: '2024-04-17 14:30:00' }, - ], + records: [], date: [`${new Date().getFullYear()}`, `${new Date().getMonth() + 1}`], currentDate: [`${new Date().getFullYear()}`, `${new Date().getMonth() + 1}`], show: false, showDate: false, loading: false, showTerm: false, - type: { sale: '收入', cashout: '提现', manual: "其他" } + param: { + year: new Date().getFullYear(), + month: new Date().getMonth() + 1, + } } }, methods: { + init() { + Promise.all([ + this.$get('/v1/client/DShopsClient/moneystatistics', this.param), + this.$get('/v1/client/DShopsClient/money', this.param) + ]).then(([total, recordsRes]) => { + this.data.total = total.data; + this.records = recordsRes.data; + }).catch(err => { + this.$showFailToast(err.message || '加载失败'); + }) + }, onconfirm(value) { this.date = this.currentDate; + this.param = { + year: parseInt(this.currentDate[0]), + month: parseInt(this.currentDate[1]), + } this.showDate = false; + this.init(); }, onShowTerm() { this.showTerm = true; } - } + }, + } diff --git a/src/views/Merchant/MerchantIntroduction.vue b/src/views/Merchant/MerchantIntroduction.vue index 5a84524..3eaa9c1 100644 --- a/src/views/Merchant/MerchantIntroduction.vue +++ b/src/views/Merchant/MerchantIntroduction.vue @@ -4,8 +4,7 @@
- -
+
@@ -23,10 +22,10 @@
- - - + + +
@@ -36,11 +35,12 @@ 仅展示
- - + +
-
+
运费 - - {{ product.expressprice ? '¥' + product.expressprice.toFixed(2) : '¥0.00' }} - + ¥{{ freight.toFixed(2) }} +
+
+ 抵扣金额 + -¥{{ actualDeduct?.toFixed(2) || '0.00' }}
实付金额 - {{ product.saleprice ? '¥' + (product.saleprice * product.buynums).toFixed(2) : '¥0.00' - }} + ¥{{ actualPay?.toFixed(2) || '0.00' }}
@@ -94,7 +96,7 @@
-