supplierDetaileButton.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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" @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: ''
  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:[1,2],status: true},
  40. ]
  41. }
  42. },
  43. created(){
  44. this.initData(this.status)
  45. },
  46. computed: {
  47. },
  48. methods:{
  49. initData(resVal) {
  50. /**
  51. * @分享按钮统一显示
  52. * @按钮根据状态显示
  53. * @(1,2)显示[发货]按钮
  54. */
  55. this.btnState = this.initStatus()
  56. this.mapStateArr.forEach(el => {
  57. el.val.forEach(value => {
  58. if(resVal === value){
  59. this.btnState[el.label] = el.status
  60. //console.log(this.btnState[el.label]);
  61. }
  62. })
  63. })
  64. },
  65. initStatus(){
  66. let btnState= {
  67. isQuery: false,
  68. isDelete: false,
  69. isCancel: false,
  70. isConfirm: false,
  71. }
  72. return btnState
  73. },
  74. getShareCode(code){
  75. this.shareCode = code
  76. },
  77. onShareCode(){
  78. this.$parent.isShareModal = true
  79. this.$emit('shareConfirm')
  80. },
  81. btnConfirm(type){
  82. this.$emit('buttonConfirm',type)
  83. }
  84. }
  85. }
  86. </script>
  87. <style lang="scss">
  88. .button-template{
  89. width: 100%;
  90. height: auto;
  91. position: fixed;
  92. bottom: 0;
  93. left: 0;
  94. background: #FFFFFF;
  95. .button-content{
  96. width: 702rpx;
  97. padding:0 24rpx;
  98. height: auto;
  99. float: left;
  100. position: relative;
  101. .share-code{
  102. width: 200rpx;
  103. height: 64rpx;
  104. line-height: 64rpx;
  105. color: #2A45FF;
  106. text-align: left;
  107. position: absolute;
  108. font-size: $font-size-28;
  109. font-weight: bold;
  110. left: 24rpx;
  111. top: 24rpx;
  112. }
  113. .btn{
  114. width: 160rpx;
  115. height: 64rpx;
  116. margin:22rpx;
  117. line-height: 64rpx;
  118. font-size:$font-size-26;
  119. color: #FFFFFF;
  120. text-align: center;
  121. border-radius: 10rpx;
  122. float: right;
  123. }
  124. .btn-color{
  125. background: $btn-confirm;
  126. margin: 22rpx 0 22rpx 22rpx;
  127. .tips{
  128. width: 160rpx;
  129. height: 34rpx;
  130. padding: 10rpx 10rpx;
  131. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  132. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  133. border-radius: 8rpx;
  134. position: absolute;
  135. color: #FFFFFF;
  136. line-height: 34rpx;
  137. font-size: $font-size-24;
  138. text-align: left;
  139. right: 24rpx;
  140. top: -45rpx;
  141. &:before{
  142. content: "";
  143. width: 25rpx;
  144. height: 25rpx;
  145. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  146. position: absolute;
  147. bottom: -8rpx;
  148. right: 30rpx;
  149. z-index: -1;
  150. transform:rotate(45deg);
  151. }
  152. }
  153. }
  154. .btn-cancel{
  155. background:#FFFFFF;
  156. color: #999999;
  157. float: left;
  158. margin: 22rpx 0;
  159. text-align: left;
  160. }
  161. .btn-delete{
  162. background:linear-gradient(315deg,rgba(255,163,3,1) 0%,rgba(255,53,1,1) 100%);
  163. }
  164. .btn-query{
  165. background:linear-gradient(135deg,rgba(255,212,129,1) 0%,rgba(198,129,0,1) 100%);
  166. }
  167. .btn-confirm{
  168. background:linear-gradient(315deg,rgba(231,0,0,1) 0%,rgba(255,104,1,1) 100%);
  169. }
  170. .btn-share{
  171. background:linear-gradient(315deg,rgba(0,212,150,1) 0%,rgba(126,243,174,1) 100%);
  172. margin-right: 0;
  173. position: relative;
  174. .tips{
  175. width: 160rpx;
  176. height: 34rpx;
  177. padding: 10rpx 10rpx;
  178. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  179. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  180. border-radius: 8rpx;
  181. position: absolute;
  182. color: #FFFFFF;
  183. line-height: 34rpx;
  184. font-size: $font-size-24;
  185. text-align: left;
  186. right: 0;
  187. top: -65rpx;
  188. &:before{
  189. content: "";
  190. width: 25rpx;
  191. height: 25rpx;
  192. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  193. position: absolute;
  194. bottom: -8rpx;
  195. right: 30rpx;
  196. z-index: -1;
  197. transform:rotate(45deg);
  198. }
  199. }
  200. }
  201. }
  202. }
  203. </style>