orderButton.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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-cancel" v-if="order.checkFlag === 2" @click.stop="btnConfirm('upload',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" @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: [2, 3, 5, 6, 12, 13, 22, 23, 32, 33], status: true },
  50. { label: 'isDelete', val: [4], status: true },
  51. { label: 'isCancel', val: [0, 11], 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], status: true }
  55. ]
  56. }
  57. },
  58. created(){
  59. this.initData(this.status)
  60. },
  61. computed: {
  62. },
  63. methods:{
  64. initData(resVal) {
  65. /**
  66. * @分享按钮统一显示
  67. * @按钮根据状态显示
  68. * @(4、5、7、12、22、23、32)显示[查看物流]按钮,其他隐藏
  69. * @(6)显示[删除订单],其他隐藏
  70. * @(0、111)显示[取消订单],其他隐藏
  71. * @(21,31)只显示分享
  72. * @(13,33)显示[确认收货]和[查看物流]
  73. */
  74. this.btnState = this.initStatus()
  75. this.mapStateArr.forEach(el => {
  76. el.val.forEach(value => {
  77. if(resVal === value){
  78. this.btnState[el.label] = el.status
  79. }
  80. })
  81. })
  82. },
  83. initStatus(){
  84. let btnState= {
  85. isQuery: false,
  86. isDelete: false,
  87. isCancel: false,
  88. isConfirm: false,
  89. isConfirmation:false,
  90. }
  91. return btnState
  92. },
  93. getShareCode(code){
  94. this.shareCode = code
  95. },
  96. onShareCode(){
  97. this.$parent.isShareModal = true
  98. this.$emit('shareConfirm')
  99. },
  100. btnConfirm(type,order){
  101. let data = {
  102. type:type,
  103. orderId:order.shopOrderId,
  104. order:order
  105. }
  106. this.$emit('buttonConfirm',data)
  107. }
  108. }
  109. }
  110. </script>
  111. <style lang="scss">
  112. .button-template{
  113. width: 100%;
  114. height: auto;
  115. position: fixed;
  116. bottom: 0;
  117. left: 0;
  118. background: #FFFFFF;
  119. // z-index: 99999;
  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-firm{
  175. position:relative;
  176. .tips{
  177. width: 74rpx;
  178. height: 32rpx;
  179. line-height: 32rpx;
  180. padding: 0 7rpx;
  181. border-radius: 16rpx;
  182. background-color: #ffe6dc;
  183. color: $color-system;
  184. text-align: center;
  185. font-size: $font-size-20;
  186. position:absolute;
  187. right: 0;
  188. top: -40rpx;
  189. z-index: 90;
  190. .line{
  191. display: block;
  192. width: 20rpx;
  193. height: 20rpx;
  194. background-color: #ffe6dc;
  195. position: relative;
  196. bottom: 18rpx;
  197. left: 15rpx;
  198. z-index: -1;
  199. transform:rotate(45deg);
  200. }
  201. }
  202. }
  203. .btn-share{
  204. .tips{
  205. width: 160rpx;
  206. height: 34rpx;
  207. padding: 10rpx 10rpx;
  208. background:#F3B574;
  209. border-radius: 8rpx;
  210. position: absolute;
  211. color: #FFFFFF;
  212. line-height: 34rpx;
  213. font-size: $font-size-24;
  214. text-align: left;
  215. right: 0;
  216. top: -65rpx;
  217. &:before{
  218. content: "";
  219. width: 25rpx;
  220. height: 25rpx;
  221. background:#F3B574;
  222. position: absolute;
  223. bottom: -8rpx;
  224. left: 30rpx;
  225. z-index: -1;
  226. transform:rotate(45deg);
  227. }
  228. }
  229. }
  230. }
  231. }
  232. </style>