orderButton.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template name="button">
  2. <view class="button-template" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  3. <!-- 底部按钮 -->
  4. <view class="button-content">
  5. <!-- <view class="btn btn-payment" v-if="order.affirmPaymentFlag == 10" @click.stop="btnConfirm('payment',order)">确认打款<text>供应商</text></view> -->
  6. <!-- <view class="btn btn-confirm" v-if="btnState.isConfirmation" @click.stop="btnConfirm('confirmation',order)">确认订单</view> -->
  7. <view class="btn btn-pay" v-if="btnState.isPay" @click.stop="btnConfirm('pay',order)">付款</view>
  8. <view class="btn btn-upload" v-if="btnState.isUpload" @click.stop="btnConfirm('pay',order)">上传凭证</view>
  9. <view class="btn btn-share" @click.stop="onShareCode">
  10. <view class="tips" v-if="shareCode">分享码:{{shareCode}}</view>
  11. 分享订单
  12. </view>
  13. <view class="btn btn-cancel" v-if="btnState.isCancel" @click.stop="btnConfirm('cancel',order)">取消订单</view>
  14. <!-- <view class="btn btn-delete" v-if="btnState.isDelete" @click.stop="btnConfirm('delete',order)">删除订单</view> -->
  15. <view class="btn btn-query" v-if="btnState.isQuery && order.secondHandOrderFlag!=1" @click.stop="btnConfirm('query',order)">查看物流</view>
  16. <view class="btn btn-firm" v-if="btnState.isConfirm" @click.stop="btnConfirm('confirm',order)">
  17. 确认收货
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default{
  24. name:'button',
  25. props:{
  26. status:{
  27. type:Number
  28. },
  29. order: {
  30. type:Object
  31. },
  32. shareCode:{
  33. type:String
  34. },
  35. },
  36. watch:{
  37. status:{
  38. handler:function(val){
  39. this.initData(val)
  40. },
  41. deep:true//对象内部的属性监听,也叫深度监听
  42. }
  43. },
  44. data() {
  45. return{
  46. btnState:this.initStatus(),
  47. isIphoneX:this.$store.state.isIphoneX,
  48. mapStateArr:[
  49. {label:'isQuery',val:[4,5,12,13,33,22,23,32,77],status: true},
  50. {label:'isDelete',val:[6],status: true},
  51. {label:'isCancel',val:[0,111,333],status: true},
  52. {label:'isConfirm',val:[33],status: true},
  53. {label:'isConfirmation',val:[0],status: true},
  54. {label:'isPay',val:[11,12,13,21,22,23,111,333],status: true},
  55. {label:'isUpload',val:[11,12,13,21,22,23,111,333],status: true},
  56. ]
  57. }
  58. },
  59. created(){
  60. this.initData(this.status)
  61. },
  62. computed: {
  63. },
  64. methods:{
  65. initData(resVal) {
  66. /**
  67. * @分享按钮统一显示
  68. * @按钮根据状态显示
  69. * @(4、5、7、12、22、23、32)显示[查看物流]按钮,其他隐藏
  70. * @(6)显示[删除订单],其他隐藏
  71. * @(0、111)显示[取消订单],其他隐藏
  72. * @(21,31)只显示分享
  73. * @(13,33)显示[确认收货]和[查看物流]
  74. */
  75. this.btnState = this.initStatus()
  76. this.mapStateArr.forEach(el => {
  77. el.val.forEach(value => {
  78. if(resVal === value){
  79. this.btnState[el.label] = el.status
  80. }
  81. })
  82. })
  83. },
  84. initStatus(){
  85. let btnState= {
  86. isQuery: false,
  87. isDelete: false,
  88. isCancel: false,
  89. isConfirm: false,
  90. isConfirmation:false,
  91. }
  92. return btnState
  93. },
  94. getShareCode(code){
  95. this.shareCode = code
  96. },
  97. onShareCode(){
  98. this.$parent.isShareModal = true
  99. this.$emit('shareConfirm')
  100. },
  101. btnConfirm(type,order){
  102. let data = {
  103. type:type,
  104. orderId:order.orderId,
  105. order:order
  106. }
  107. this.$emit('buttonConfirm',data)
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss">
  113. .button-template{
  114. width: 100%;
  115. height: auto;
  116. position: fixed;
  117. bottom: 0;
  118. left: 0;
  119. background: #FFFFFF;
  120. .button-content{
  121. padding:0 24rpx;
  122. height: auto;
  123. float: right;
  124. position: relative;
  125. .share-code{
  126. width: 200rpx;
  127. height: 64rpx;
  128. line-height: 64rpx;
  129. color: #2A45FF;
  130. text-align: left;
  131. position: absolute;
  132. font-size: $font-size-28;
  133. font-weight: bold;
  134. left: 24rpx;
  135. top: 24rpx;
  136. }
  137. .btn{
  138. width: 150rpx;
  139. height: 64rpx;
  140. margin:22rpx 22rpx 22rpx 0;
  141. line-height: 64rpx;
  142. font-size:$font-size-26;
  143. color: #666666;
  144. text-align: center;
  145. float: right;
  146. border: 2rpx solid #999999;
  147. border-radius: 34rpx;
  148. &.btn-payment{
  149. line-height: 38rpx;
  150. font-size: 24rpx;
  151. background: #f9a94b;
  152. color: #fff;
  153. border: 2rpx solid #f9a94b;
  154. text{
  155. display: block;
  156. line-height: 15rpx;
  157. }
  158. }
  159. &.btn-share{
  160. position: relative;
  161. }
  162. }
  163. .btn-confirm{
  164. background:#ff7a51;
  165. border-color:#ff7a51;
  166. color: #FFFFFF;
  167. }
  168. .btn-pay{
  169. background:$btn-confirm;
  170. margin-right: 0;
  171. border: 2rpx solid $btn-confirm;
  172. color: #fff;
  173. }
  174. .btn-upload{
  175. background:#0ABC64;
  176. margin-right: 0;
  177. border: 2rpx solid #0ABC64;
  178. color: #fff;
  179. }
  180. .btn-firm{
  181. position:relative;
  182. .tips{
  183. width: 74rpx;
  184. height: 32rpx;
  185. line-height: 32rpx;
  186. padding: 0 7rpx;
  187. border-radius: 16rpx;
  188. background-color: #ffe6dc;
  189. color: $color-system;
  190. text-align: center;
  191. font-size: $font-size-20;
  192. position:absolute;
  193. right: 0;
  194. top: -40rpx;
  195. z-index: 90;
  196. .line{
  197. display: block;
  198. width: 20rpx;
  199. height: 20rpx;
  200. background-color: #ffe6dc;
  201. position: relative;
  202. bottom: 18rpx;
  203. left: 15rpx;
  204. z-index: -1;
  205. transform:rotate(45deg);
  206. }
  207. }
  208. }
  209. .btn-share{
  210. .tips{
  211. width: 160rpx;
  212. height: 34rpx;
  213. padding: 10rpx 10rpx;
  214. background:#F3B574;
  215. border-radius: 8rpx;
  216. position: absolute;
  217. color: #FFFFFF;
  218. line-height: 34rpx;
  219. font-size: $font-size-24;
  220. text-align: left;
  221. right: 0;
  222. top: -65rpx;
  223. &:before{
  224. content: "";
  225. width: 25rpx;
  226. height: 25rpx;
  227. background:#F3B574;
  228. position: absolute;
  229. bottom: -8rpx;
  230. left: 30rpx;
  231. z-index: -1;
  232. transform:rotate(45deg);
  233. }
  234. }
  235. }
  236. }
  237. }
  238. </style>