123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <template name="button">
- <view class="button-template" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
- <!-- 底部按钮 -->
- <view class="button-content">
- <!-- <view class="btn btn-payment" v-if="order.affirmPaymentFlag == 10" @click.stop="btnConfirm('payment',order)">确认打款<text>供应商</text></view> -->
- <!-- <view class="btn btn-confirm" v-if="btnState.isConfirmation" @click.stop="btnConfirm('confirmation',order)">确认订单</view> -->
- <view class="btn btn-pay" v-if="btnState.isPay" @click.stop="btnConfirm('pay',order)">付款</view>
- <view class="btn btn-cancel" v-if="order.checkFlag === 1" @click.stop="btnConfirm('upload',order)">上传凭证</view>
- <view class="btn btn-share" @click.stop="onShareCode">
- <view class="tips" v-if="shareCode">分享码:{{shareCode}}</view>
- 分享订单
- </view>
- <view class="btn btn-cancel" v-if="btnState.isCancel" @click.stop="btnConfirm('cancel',order)">取消订单</view>
- <!-- <view class="btn btn-delete" v-if="btnState.isDelete" @click.stop="btnConfirm('delete',order)">删除订单</view> -->
- <view class="btn btn-query" v-if="btnState.isQuery" @click.stop="btnConfirm('query',order)">查看物流</view>
- <view class="btn btn-firm" v-if="btnState.isConfirm" @click.stop="btnConfirm('confirm',order)">
- 确认收货
- </view>
-
- </view>
- </view>
- </template>
- <script>
- export default{
- name:'button',
- props:{
- status:{
- type:Number
- },
- order: {
- type:Object
- },
- shareCode:{
- type:String
- },
- },
- watch:{
- status:{
- handler:function(val){
- this.initData(val)
- },
- deep:true//对象内部的属性监听,也叫深度监听
- }
- },
- data() {
- return{
- btnState:this.initStatus(),
- isIphoneX:this.$store.state.isIphoneX,
- mapStateArr:[
- {label:'isQuery',val:[4,5,12,13,33,22,23,32,77],status: true},
- {label:'isDelete',val:[6],status: true},
- {label:'isCancel',val:[0,111],status: true},
- {label:'isConfirm',val:[33],status: true},
- {label:'isConfirmation',val:[0],status: true},
- {label:'isPay',val:[11,12,13,21,22,23,111],status: true},
- {label:'isUpload',val:[11,12,13,21,22,23,111],status: true},
- ]
- }
- },
- created(){
- this.initData(this.status)
- },
- computed: {
- },
- methods:{
- initData(resVal) {
- /**
- * @分享按钮统一显示
- * @按钮根据状态显示
- * @(4、5、7、12、22、23、32)显示[查看物流]按钮,其他隐藏
- * @(6)显示[删除订单],其他隐藏
- * @(0、111)显示[取消订单],其他隐藏
- * @(21,31)只显示分享
- * @(13,33)显示[确认收货]和[查看物流]
- */
- this.btnState = this.initStatus()
- this.mapStateArr.forEach(el => {
- el.val.forEach(value => {
- if(resVal === value){
- this.btnState[el.label] = el.status
- }
- })
- })
- },
- initStatus(){
- let btnState= {
- isQuery: false,
- isDelete: false,
- isCancel: false,
- isConfirm: false,
- isConfirmation:false,
- }
- return btnState
- },
- getShareCode(code){
- this.shareCode = code
- },
- onShareCode(){
- this.$parent.isShareModal = true
- this.$emit('shareConfirm')
- },
- btnConfirm(type,order){
- let data = {
- type:type,
- orderId:order.orderId,
- order:order
- }
- this.$emit('buttonConfirm',data)
- }
- }
- }
- </script>
- <style lang="scss">
- .button-template{
- width: 100%;
- height: auto;
- position: fixed;
- bottom: 0;
- left: 0;
- background: #FFFFFF;
- z-index: 99999;
- .button-content{
- padding:0 24rpx;
- height: auto;
- float: right;
- position: relative;
- .share-code{
- width: 200rpx;
- height: 64rpx;
- line-height: 64rpx;
- color: #2A45FF;
- text-align: left;
- position: absolute;
- font-size: $font-size-28;
- font-weight: bold;
- left: 24rpx;
- top: 24rpx;
- }
- .btn{
- width: 150rpx;
- height: 64rpx;
- margin:22rpx 22rpx 22rpx 0;
- line-height: 64rpx;
- font-size:$font-size-26;
- color: #666666;
- text-align: center;
- float: right;
- border: 2rpx solid #999999;
- border-radius: 34rpx;
- &.btn-payment{
- line-height: 38rpx;
- font-size: 24rpx;
- background: #f9a94b;
- color: #fff;
- border: 2rpx solid #f9a94b;
- text{
- display: block;
- line-height: 15rpx;
- }
- }
- &.btn-share{
- position: relative;
- }
- }
- .btn-confirm{
- background:#ff7a51;
- border-color:#ff7a51;
- color: #FFFFFF;
- }
- .btn-pay{
- background:$btn-confirm;
- margin-right: 0;
- border: 2rpx solid $btn-confirm;
- color: #fff;
- }
- .btn-firm{
- position:relative;
- .tips{
- width: 74rpx;
- height: 32rpx;
- line-height: 32rpx;
- padding: 0 7rpx;
- border-radius: 16rpx;
- background-color: #ffe6dc;
- color: $color-system;
- text-align: center;
- font-size: $font-size-20;
- position:absolute;
- right: 0;
- top: -40rpx;
- z-index: 90;
- .line{
- display: block;
- width: 20rpx;
- height: 20rpx;
- background-color: #ffe6dc;
- position: relative;
- bottom: 18rpx;
- left: 15rpx;
- z-index: -1;
- transform:rotate(45deg);
- }
- }
- }
- .btn-share{
- .tips{
- width: 160rpx;
- height: 34rpx;
- padding: 10rpx 10rpx;
- background:#F3B574;
- border-radius: 8rpx;
- position: absolute;
- color: #FFFFFF;
- line-height: 34rpx;
- font-size: $font-size-24;
- text-align: left;
- right: 0;
- top: -65rpx;
- &:before{
- content: "";
- width: 25rpx;
- height: 25rpx;
- background:#F3B574;
- position: absolute;
- bottom: -8rpx;
- left: 30rpx;
- z-index: -1;
- transform:rotate(45deg);
- }
- }
- }
- }
- }
- </style>
|