|
|
@@ -3,7 +3,7 @@
|
|
|
<view class="billing_box_bg">
|
|
|
<view class="top-view"> </view>
|
|
|
<view class="result-view">
|
|
|
- <view style="text-align:center;margin-top:20upx;margin-bottom:60upx;font-size:30upx;">编号:{{id}}</view>
|
|
|
+ <view style="text-align:center;margin-top:20upx;margin-bottom:60upx;font-size:30upx;">编号:{{purchaseId}}</view>
|
|
|
<button v-if="showButton" class="admin-button-com big blue" style="width:45vw;" @click="showCgOrder()">点击查看订单</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -11,98 +11,43 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { getWeixinId } from "@/api/invite/index"
|
|
|
-import { getCgSalt } from "@/api/order"
|
|
|
export default {
|
|
|
name: "showCgOrder",
|
|
|
data() {
|
|
|
return {
|
|
|
getAppIdList:{},
|
|
|
showButton:false,
|
|
|
- id:0,
|
|
|
purchaseId:0,
|
|
|
- cgSalt:'',
|
|
|
- saltRequestId:0,
|
|
|
- saltPromise:null,
|
|
|
- loadedOptionId:0,
|
|
|
- ignoreNextShowId:0
|
|
|
+ cgSalt:''
|
|
|
};
|
|
|
},
|
|
|
- onLoad(option) {
|
|
|
- this.setOptionInfo(option || this.option || {}, true)
|
|
|
- this.ignoreNextShowId = this.id
|
|
|
- let that = this
|
|
|
+ onLoad() {
|
|
|
+ this.parseOption()
|
|
|
getWeixinId().then(res => {
|
|
|
- that.getAppIdList = res.data
|
|
|
- that.showButton = true
|
|
|
+ this.getAppIdList = res.data
|
|
|
+ this.showButton = true
|
|
|
})
|
|
|
},
|
|
|
- onShow() {
|
|
|
- const option = this.option || {}
|
|
|
- const id = option.id || 0
|
|
|
- if(id && this.ignoreNextShowId == id){
|
|
|
- this.ignoreNextShowId = 0
|
|
|
- this.setOptionInfo(option)
|
|
|
- return false
|
|
|
- }
|
|
|
- this.setOptionInfo(option, true)
|
|
|
- },
|
|
|
methods: {
|
|
|
init(){
|
|
|
- this.setOptionInfo(this.option || {}, true)
|
|
|
+ this.parseOption()
|
|
|
},
|
|
|
- setOptionInfo(option, refreshSalt = false){
|
|
|
- const id = option.id || 0
|
|
|
- if(!id){
|
|
|
- return false
|
|
|
- }
|
|
|
- if(this.id != id){
|
|
|
- this.cgSalt = ''
|
|
|
- this.purchaseId = 0
|
|
|
- this.saltRequestId = 0
|
|
|
- this.saltPromise = null
|
|
|
- }
|
|
|
- this.id = id
|
|
|
- if(refreshSalt || this.loadedOptionId != id){
|
|
|
- this.loadedOptionId = id
|
|
|
- this.getCgSaltInfo()
|
|
|
- }
|
|
|
+ parseOption() {
|
|
|
+ const option = this.option || {}
|
|
|
+ this.purchaseId = option.id || 0
|
|
|
+ this.cgSalt = option.salt || ''
|
|
|
},
|
|
|
- getCgSaltInfo(){
|
|
|
- if(!this.id){
|
|
|
- return Promise.resolve(false)
|
|
|
- }
|
|
|
- if(this.saltPromise && this.saltRequestId == this.id){
|
|
|
- return this.saltPromise
|
|
|
- }
|
|
|
- this.saltRequestId = this.id
|
|
|
- this.saltPromise = getCgSalt({id:this.id}).then(res => {
|
|
|
- this.purchaseId = res.data.purchaseId || 0
|
|
|
- this.cgSalt = res.data.cgSalt || ''
|
|
|
- this.saltPromise = null
|
|
|
- return this.cgSalt
|
|
|
- }).catch(err => {
|
|
|
- this.saltPromise = null
|
|
|
- throw err
|
|
|
- })
|
|
|
- return this.saltPromise
|
|
|
- },
|
|
|
- async showCgOrder() {
|
|
|
- let that = this
|
|
|
- if(!that.cgSalt){
|
|
|
- await that.getCgSaltInfo()
|
|
|
- }
|
|
|
- const salt = that.cgSalt || ''
|
|
|
- const purchaseId = that.purchaseId || 0
|
|
|
- if(!purchaseId || !salt){
|
|
|
- that.$msg('订单信息获取失败')
|
|
|
+ showCgOrder() {
|
|
|
+ const purchaseId = this.purchaseId || 0
|
|
|
+ const salt = this.cgSalt || ''
|
|
|
+ if (!purchaseId || !salt) {
|
|
|
+ this.$msg('订单信息无效')
|
|
|
return false
|
|
|
}
|
|
|
console.log('pagesPurchase/purDetails?id='+purchaseId+'&salt='+salt)
|
|
|
uni.navigateToMiniProgram({
|
|
|
- //姜枫-2021.04.13
|
|
|
- appId: that.getAppIdList.hd.miniAppId,
|
|
|
+ appId: this.getAppIdList.hd.miniAppId,
|
|
|
path: 'pagesPurchase/purDetails?id='+purchaseId+'&salt='+salt,
|
|
|
- //develop 开发版 trial 体验版 release 正式版
|
|
|
envVersion: process.env.NODE_ENV === 'development' ? 'develop' : 'release',
|
|
|
extraData: {
|
|
|
'id': purchaseId,
|