sellerDetaileButton.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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-cancel" v-if="btnState.isCancel" @click.stop="btnConfirm('cancel',order)">取消订单</view>
  6. <view class="btn btn-cancel" v-if="btnState.isDelete" @click.stop="btnConfirm('delete',order)">删除订单</view>
  7. <view class="btn btn-color" @click.stop="onShareCode">
  8. <view class="tips" v-if="shareCode">分享码:{{shareCode}}</view>
  9. 分享订单
  10. </view>
  11. <view class="btn btn-color" v-if="btnState.isConfirm" @click.stop="btnConfirm('confirm',order)">确认订单</view>
  12. <view class="btn btn-color" v-if="btnState.isPay && ableUserMoney > 0 && !rechargeGoods" @click.stop="btnConfirm('balance',order)">余额抵扣</view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default{
  18. name:"button",
  19. props:{
  20. status:{
  21. type:Number
  22. },
  23. order: {
  24. type:Object
  25. },
  26. ableUserMoney:{
  27. type:Number
  28. },
  29. rechargeGoods:{
  30. type:Boolean
  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. invoiceStatus:false,
  49. mapStateArr:[
  50. {label:'isDelete',val:[6],status: true},
  51. {label:'isCancel',val:[0,111],status: true},
  52. {label:'isConfirm',val:[0],status: true},
  53. {label:'isPay',val:[11,12,13,21,22,23,111],status: true},
  54. ]
  55. }
  56. },
  57. created(){
  58. console.log(this.rechargeGoods);
  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. //console.log(this.btnState[el.label]);
  80. }
  81. })
  82. })
  83. },
  84. initStatus(){
  85. let btnState= {
  86. isQuery: false,
  87. isDelete: false,
  88. isCancel: false,
  89. isConfirm: false,
  90. isPay: false,
  91. }
  92. return btnState
  93. },
  94. getShareCode(code){
  95. this.shareCode = code
  96. },
  97. onShareCode(){
  98. if(this.order.onlinePayFlag!= '1'){
  99. this.PayService.PayOrderCheckoutCounter({orderId:this.order.orderID}).then(response =>{
  100. let data = response.data.order
  101. this.invoiceStatus = data.invoiceStatus
  102. //判断线上线下显示
  103. if(this.invoiceStatus){
  104. this.$util.modal('提示','由于商品发票属性的限制,本订单不能进行线上支付,请让客户选择线下转账方式付款','继续分享','知道了',true,() =>{
  105. this.$parent.isShareModal = true
  106. })
  107. }else{
  108. this.$parent.isShareModal = true
  109. }
  110. }).catch(error =>{
  111. this.$util.msg(error.msg,2000)
  112. })
  113. }else{
  114. this.$parent.isShareModal = true
  115. }
  116. // this.$emit('shareConfirm')
  117. },
  118. btnConfirm(type,order){
  119. let data = {
  120. type:type,
  121. orderId:order.orderID,
  122. order:order
  123. }
  124. this.$emit('buttonConfirm',data)
  125. }
  126. }
  127. }
  128. </script>
  129. <style lang="scss">
  130. .button-template{
  131. width: 100%;
  132. height: auto;
  133. position: fixed;
  134. bottom: 0;
  135. left: 0;
  136. background: #FFFFFF;
  137. .button-content{
  138. width: 702rpx;
  139. padding:0 24rpx;
  140. height: auto;
  141. float: left;
  142. position: relative;
  143. .share-code{
  144. width: 200rpx;
  145. height: 64rpx;
  146. line-height: 64rpx;
  147. color: #2A45FF;
  148. text-align: left;
  149. position: absolute;
  150. font-size: $font-size-28;
  151. font-weight: bold;
  152. left: 24rpx;
  153. top: 24rpx;
  154. }
  155. .btn{
  156. width: 160rpx;
  157. height: 64rpx;
  158. margin:22rpx;
  159. line-height: 64rpx;
  160. font-size:$font-size-26;
  161. color: #FFFFFF;
  162. text-align: center;
  163. border-radius: 6rpx;
  164. float: right;
  165. }
  166. .btn-color{
  167. background: $btn-confirm;
  168. margin: 20rpx 0 20rpx 20rpx;
  169. .tips{
  170. width: 160rpx;
  171. height: 34rpx;
  172. padding: 10rpx 10rpx;
  173. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  174. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  175. border-radius: 8rpx;
  176. position: absolute;
  177. color: #FFFFFF;
  178. line-height: 34rpx;
  179. font-size: $font-size-24;
  180. text-align: left;
  181. right: 24rpx;
  182. top: -45rpx;
  183. &:before{
  184. content: "";
  185. width: 25rpx;
  186. height: 25rpx;
  187. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  188. position: absolute;
  189. bottom: -8rpx;
  190. right: 30rpx;
  191. z-index: -1;
  192. transform:rotate(45deg);
  193. }
  194. }
  195. }
  196. .btn-cancel{
  197. background:#FFFFFF;
  198. color: #999999;
  199. float: left;
  200. margin: 22rpx 0;
  201. text-align: left;
  202. }
  203. .btn-delete{
  204. background:linear-gradient(315deg,rgba(255,163,3,1) 0%,rgba(255,53,1,1) 100%);
  205. }
  206. .btn-query{
  207. background:linear-gradient(135deg,rgba(255,212,129,1) 0%,rgba(198,129,0,1) 100%);
  208. }
  209. .btn-confirm{
  210. background:linear-gradient(315deg,rgba(231,0,0,1) 0%,rgba(255,104,1,1) 100%);
  211. }
  212. .btn-share{
  213. background:linear-gradient(315deg,rgba(0,212,150,1) 0%,rgba(126,243,174,1) 100%);
  214. margin-right: 0;
  215. position: relative;
  216. .tips{
  217. width: 160rpx;
  218. height: 34rpx;
  219. padding: 10rpx 10rpx;
  220. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  221. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  222. border-radius: 8rpx;
  223. position: absolute;
  224. color: #FFFFFF;
  225. line-height: 34rpx;
  226. font-size: $font-size-24;
  227. text-align: left;
  228. right: 0;
  229. top: -65rpx;
  230. &:before{
  231. content: "";
  232. width: 25rpx;
  233. height: 25rpx;
  234. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  235. position: absolute;
  236. bottom: -8rpx;
  237. right: 30rpx;
  238. z-index: -1;
  239. transform:rotate(45deg);
  240. }
  241. }
  242. }
  243. }
  244. }
  245. </style>