Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-wx-pay
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.education.frontend
pica-wx-pay
提交
2b43f708
提交
2b43f708
编写于
1月 21, 2020
作者:
guangjun.yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
格式化代码
上级
7c61e7bb
变更
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
104 行增加
和
107 行删除
+104
-107
index.vue
src/index.vue
+104
-107
未找到文件。
src/index.vue
浏览文件 @
2b43f708
<
template
>
<
template
>
<section>
<section>
<button
@
click=
"createOrder"
>
点击创建订单
</button>
<button
@
click=
"createOrder"
>
点击创建订单
</button>
<div
class=
"detailsAndBuy"
v-show=
"orderId"
>
<div
class=
"detailsAndBuy"
v-show=
"orderId"
>
<div>
<div>
<p>
订单详情
</p>
<p>
订单详情
</p>
<p>
商品名:
{{
orderDetails
.
goodsLabel
}}
</p>
<p>
商品名:
{{
orderDetails
.
goodsLabel
}}
</p>
<p>
单价:
{{
orderDetails
.
price
}}
</p>
<p>
单价:
{{
orderDetails
.
price
}}
</p>
<p>
数量:
{{
orderDetails
.
quantity
}}
</p>
<p>
数量:
{{
orderDetails
.
quantity
}}
</p>
<p>
总价:
{{
orderDetails
.
totalFee
}}
</p>
<p>
总价:
{{
orderDetails
.
totalFee
}}
</p>
<p>
付款状态:
{{
orderDetails
.
status
}}
</p>
<p>
付款状态:
{{
orderDetails
.
status
}}
</p>
</div>
</div>
<button
class=
"buy"
@
click=
"goPrePay"
>
购买
</button>
<button
class=
"buy"
@
click=
"goPrePay"
>
购买
</button>
</div>
</div>
</section>
</section>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
name
:
"index.vue"
,
name
:
"index.vue"
,
data
()
{
data
()
{
return
{
return
{
token
:
'08A7A6D8AA224AB7BC2E7BC44D44F34E'
,
token
:
"08A7A6D8AA224AB7BC2E7BC44D44F34E"
,
orderId
:
null
,
orderId
:
null
,
prePayId
:
null
,
prePayId
:
null
,
isDisabled
:
false
,
isDisabled
:
false
,
orderDetails
:
{}
orderDetails
:
{}
}
};
},
mounted
()
{},
methods
:
{
createOrder
()
{
if
(
this
.
isDisabled
)
{
alert
(
"订单已创建"
);
return
;
}
const
data
=
{
goodsId
:
123
,
goodsVersion
:
1
,
price
:
0.01
,
quantity
:
1
};
this
.
axios
({
method
:
"POST"
,
headers
:
{
token
:
this
.
token
},
},
mounted
()
{
url
:
`
${
this
.
APIDOMAIN
}
/trade/center/order`
,
data
:
data
})
.
then
(
res
=>
{
if
(
res
.
data
.
code
==
"000000"
)
{
this
.
orderId
=
res
.
data
.
data
;
this
.
isDisabled
=
true
;
this
.
getOrderDetails
();
}
})
.
catch
(
res
=>
{
//do somethings
});
},
getOrderDetails
()
{
this
.
axios
({
method
:
"GET"
,
headers
:
{
token
:
this
.
token
},
},
methods
:
{
url
:
`
${
this
.
APIDOMAIN
}
/trade/center/order/
${
this
.
orderId
}
`
createOrder
()
{
})
if
(
this
.
isDisabled
)
{
.
then
(
res
=>
{
alert
(
'订单已创建'
);
if
(
res
.
data
.
code
==
"000000"
)
{
return
;
this
.
orderDetails
=
res
.
data
.
data
;
}
}
const
data
=
{
})
goodsId
:
123
,
.
catch
(
res
=>
{
goodsVersion
:
1
,
//do somethings
price
:
0.01
,
});
quantity
:
1
},
}
goPrePay
()
{
this
.
axios
(
this
.
axios
({
{
method
:
"POST"
,
method
:
'POST'
,
headers
:
{
headers
:
{
token
:
this
.
token
token
:
this
.
token
,
},
url
:
`
${
this
.
APIDOMAIN
}
/trade/center/order`
,
data
:
data
}
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
"000000"
)
{
this
.
orderId
=
res
.
data
.
data
;
this
.
isDisabled
=
true
;
this
.
getOrderDetails
();
}
}).
catch
((
res
)
=>
{
//do somethings
})
},
getOrderDetails
()
{
this
.
axios
(
{
method
:
'GET'
,
headers
:
{
token
:
this
.
token
,
},
url
:
`
${
this
.
APIDOMAIN
}
/trade/center/order/
${
this
.
orderId
}
`
,
}
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
"000000"
)
{
this
.
orderDetails
=
res
.
data
.
data
}
}).
catch
((
res
)
=>
{
//do somethings
})
},
goPrePay
()
{
this
.
axios
(
{
method
:
'POST'
,
headers
:
{
token
:
this
.
token
,
},
url
:
`
${
this
.
APIDOMAIN
}
/trade/center/prepay`
,
data
:
{
payChannel
:
1
,
orderId
:
this
.
orderId
}
}
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
"000000"
)
{
this
.
prePayId
=
res
.
data
.
data
;
}
}).
catch
((
res
)
=>
{
//do somethings
})
},
},
},
url
:
`
${
this
.
APIDOMAIN
}
/trade/center/prepay`
,
data
:
{
payChannel
:
1
,
orderId
:
this
.
orderId
}
})
.
then
(
res
=>
{
if
(
res
.
data
.
code
==
"000000"
)
{
this
.
prePayId
=
res
.
data
.
data
;
}
})
.
catch
(
res
=>
{
//do somethings
});
}
}
}
};
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
input
{
input
{
margin
:
0
auto
;
margin
:
0
auto
;
border
:
1px
solid
#000
;
border
:
1px
solid
#000
;
margin-bottom
:
10px
;
margin-bottom
:
10px
;
}
}
button
{
button
{
display
:
block
;
display
:
block
;
margin
:
0
auto
;
margin
:
0
auto
;
background
:
#42b983
;
background
:
#42b983
;
color
:
#fff
;
color
:
#fff
;
}
}
</
style
>
</
style
>
\ No newline at end of file
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录