supplierDetaileButton.vue 4.8 KB

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