|
|
@@ -11,6 +11,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { getWeixinId } from "@/api/invite/index"
|
|
|
+import { getCgSalt } from "@/api/purchase/index"
|
|
|
export default {
|
|
|
name: "showCgOrder",
|
|
|
data() {
|
|
|
@@ -18,7 +19,8 @@ export default {
|
|
|
getAppIdList:{},
|
|
|
showButton:false,
|
|
|
purchaseId:0,
|
|
|
- cgSalt:''
|
|
|
+ cgSalt:'',
|
|
|
+ loadingSalt:false
|
|
|
};
|
|
|
},
|
|
|
onLoad() {
|
|
|
@@ -39,7 +41,33 @@ export default {
|
|
|
},
|
|
|
showCgOrder() {
|
|
|
const purchaseId = this.purchaseId || 0
|
|
|
- const salt = this.cgSalt || ''
|
|
|
+ if (!purchaseId) {
|
|
|
+ this.$msg('订单信息无效')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (this.cgSalt) {
|
|
|
+ this.navigateToPurDetails(purchaseId, this.cgSalt)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.loadingSalt) {
|
|
|
+ this.$msg('订单无效呢,请重新分享')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.loadingSalt = true
|
|
|
+ getCgSalt({ id: purchaseId }).then(res => {
|
|
|
+ if (res.code == 1 && res.data && res.data.salt) {
|
|
|
+ this.cgSalt = res.data.salt
|
|
|
+ this.navigateToPurDetails(purchaseId, this.cgSalt)
|
|
|
+ } else {
|
|
|
+ this.$msg(res.msg || '订单信息无效')
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.$msg('订单信息无效')
|
|
|
+ }).finally(() => {
|
|
|
+ this.loadingSalt = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ navigateToPurDetails(purchaseId, salt) {
|
|
|
if (!purchaseId || !salt) {
|
|
|
this.$msg('订单信息无效')
|
|
|
return false
|