修改显示问题
This commit is contained in:
1 parent
07a90e860d
commit
88bffaa5d0
5 files changed
+22
-2
No files matched your search
@@ -13,7 +13,7 @@
|
|||||||
<view class="card-bottom">
|
<view class="card-bottom">
|
||||||
<view class="card-time">{{item.timeText}}</view>
|
<view class="card-time">{{item.timeText}}</view>
|
||||||
<view
|
<view
|
||||||
wx:if="{{isAdmin && !isIos && item.env === 0}}"
|
wx:if="{{isAdmin && item.channel !== 'apple'}}"
|
||||||
class="card-refund"
|
class="card-refund"
|
||||||
data-order="{{item.outTradeNo}}"
|
data-order="{{item.outTradeNo}}"
|
||||||
catchtap="onRefund"
|
catchtap="onRefund"
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ const TABLES = {
|
|||||||
{ name: 'openid', type: 'VARCHAR(64)', notNull: true, comment: '用户 openid' },
|
{ name: 'openid', type: 'VARCHAR(64)', notNull: true, comment: '用户 openid' },
|
||||||
{ name: 'product_id', type: 'VARCHAR(32)', notNull: true, comment: '道具 ID' },
|
{ name: 'product_id', type: 'VARCHAR(32)', notNull: true, comment: '道具 ID' },
|
||||||
{ name: 'env', type: 'TINYINT', notNull: true, default: '0', comment: '0 现网 1 沙箱' },
|
{ name: 'env', type: 'TINYINT', notNull: true, default: '0', comment: '0 现网 1 沙箱' },
|
||||||
|
{ name: 'channel', type: 'VARCHAR(16)', comment: '支付渠道:apple 表示 iOS 内购' },
|
||||||
{ name: 'amount', type: 'INT', notNull: true, default: '0', comment: '下单金额(分)' },
|
{ name: 'amount', type: 'INT', notNull: true, default: '0', comment: '下单金额(分)' },
|
||||||
{ name: 'status', type: 'VARCHAR(16)', notNull: true, default: "'created'", comment: 'created 已下单 delivered 已发货' },
|
{ name: 'status', type: 'VARCHAR(16)', notNull: true, default: "'created'", comment: 'created 已下单 delivered 已发货' },
|
||||||
{ name: 'wx_order_id', type: 'VARCHAR(64)', comment: '平台单号,唯一' },
|
{ name: 'wx_order_id', type: 'VARCHAR(64)', comment: '平台单号,唯一' },
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ async function isAdmin(openid) {
|
|||||||
|
|
||||||
const sha1 = (text) => crypto.createHash('sha1').update(text).digest('hex')
|
const sha1 = (text) => crypto.createHash('sha1').update(text).digest('hex')
|
||||||
const isPaid = (status) => status >= 2 && status <= 4 // 2 已支付待发货 / 3 发货中 / 4 已发货
|
const isPaid = (status) => status >= 2 && status <= 4 // 2 已支付待发货 / 3 发货中 / 4 已发货
|
||||||
|
// 订单渠道:7 / 8 是苹果 iOS(内购)订单,开发者不能主动退款
|
||||||
|
const isAppleOrder = (order) => [7, 8].includes(Number(order && order.order_type))
|
||||||
|
|
||||||
// 从推送的 XML 里取字段,值可能在 CDATA 里
|
// 从推送的 XML 里取字段,值可能在 CDATA 里
|
||||||
function xmlTag(xml, name) {
|
function xmlTag(xml, name) {
|
||||||
@@ -244,6 +246,7 @@ async function deliverRecord(record, order) {
|
|||||||
const delivered = await store.assignCode(record.outTradeNo, {
|
const delivered = await store.assignCode(record.outTradeNo, {
|
||||||
wxOrderId: detail.wx_order_id || record.wxOrderId || '',
|
wxOrderId: detail.wx_order_id || record.wxOrderId || '',
|
||||||
paidFee: detail.paid_fee || 0,
|
paidFee: detail.paid_fee || 0,
|
||||||
|
channel: isAppleOrder(detail) ? 'apple' : 'wxpay',
|
||||||
})
|
})
|
||||||
const notify = await tryNotify(delivered)
|
const notify = await tryNotify(delivered)
|
||||||
return {
|
return {
|
||||||
@@ -343,6 +346,7 @@ async function myCodes(code) {
|
|||||||
productId: record.productId,
|
productId: record.productId,
|
||||||
productName: await nameOf(record.productId),
|
productName: await nameOf(record.productId),
|
||||||
env: record.env || 0,
|
env: record.env || 0,
|
||||||
|
channel: record.channel || '',
|
||||||
deliveredAt: record.deliveredAt,
|
deliveredAt: record.deliveredAt,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ const ORDER_COLUMNS = [
|
|||||||
'openid',
|
'openid',
|
||||||
'product_id',
|
'product_id',
|
||||||
'env',
|
'env',
|
||||||
|
'channel',
|
||||||
'amount',
|
'amount',
|
||||||
'status',
|
'status',
|
||||||
'wx_order_id',
|
'wx_order_id',
|
||||||
@@ -34,6 +35,7 @@ function toRecord(row) {
|
|||||||
openid: row.openid,
|
openid: row.openid,
|
||||||
productId: row.product_id,
|
productId: row.product_id,
|
||||||
env: row.env,
|
env: row.env,
|
||||||
|
channel: row.channel || '',
|
||||||
amount: row.amount,
|
amount: row.amount,
|
||||||
status: row.status,
|
status: row.status,
|
||||||
code: row.code || '',
|
code: row.code || '',
|
||||||
@@ -55,6 +57,7 @@ async function saveOrder(record) {
|
|||||||
record.openid,
|
record.openid,
|
||||||
String(record.productId),
|
String(record.productId),
|
||||||
record.env || 0,
|
record.env || 0,
|
||||||
|
record.channel || null,
|
||||||
record.amount || 0,
|
record.amount || 0,
|
||||||
record.status || 'created',
|
record.status || 'created',
|
||||||
record.wxOrderId || null,
|
record.wxOrderId || null,
|
||||||
|
|||||||
+13
-1
@@ -84,7 +84,14 @@ const fakeWx = http.createServer((req, res) => {
|
|||||||
return reply({
|
return reply({
|
||||||
errcode: 0,
|
errcode: 0,
|
||||||
errmsg: 'ok',
|
errmsg: 'ok',
|
||||||
order: { order_id: orderId, status, paid_fee: 10, left_fee: 10, wx_order_id: `wx-${env}-${orderId}` },
|
order: {
|
||||||
|
order_id: orderId,
|
||||||
|
status,
|
||||||
|
order_type: 0, // 0 普通虚拟支付(7 才是苹果内购)
|
||||||
|
paid_fee: 10,
|
||||||
|
left_fee: 10,
|
||||||
|
wx_order_id: `wx-${env}-${orderId}`,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (urlPath === '/xpay/notify_provide_goods') {
|
if (urlPath === '/xpay/notify_provide_goods') {
|
||||||
@@ -336,6 +343,11 @@ async function main() {
|
|||||||
[sandboxDelivered.code, '补单专用'],
|
[sandboxDelivered.code, '补单专用'],
|
||||||
].sort()
|
].sort()
|
||||||
)
|
)
|
||||||
|
// 退款按钮的显隐看订单渠道:普通虚拟支付记成 wxpay,苹果内购记成 apple
|
||||||
|
assert.deepStrictEqual(
|
||||||
|
Array.from(new Set(mine.list.map((item) => item.channel))),
|
||||||
|
['wxpay']
|
||||||
|
)
|
||||||
const others = await fetchJson(port, '/pay/my', { code: 'code-other' })
|
const others = await fetchJson(port, '/pay/my', { code: 'code-other' })
|
||||||
assert.deepStrictEqual(others.list, [])
|
assert.deepStrictEqual(others.list, [])
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user