orderButton.vue 6.0 KB

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