index2.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <view class="app-content">
  3. <view class="billing_box_bg">
  4. <view class="input-wrap" >
  5. <view style="padding:0upx 0upx 0upx 0upx;margin-right:10upx;" >
  6. <button class="admin-button-com middle blue" @click="selectFlowerNumFn()">图片分类</button>
  7. </view>
  8. <view class="search-bar">
  9. <app-search-module ref="globalSearchRef" v-model="globalPy" placeholder="这里搜索" @input="globalSearch" />
  10. </view>
  11. <view style="float:right;">
  12. <button class="admin-button-com middle blue" @click="removeFromSave(option.customId)">清除花材</button>
  13. </view>
  14. </view>
  15. <view class="scroll-middle_bx">
  16. <scroll-view scroll-y scroll-with-animation class="tab-view">
  17. <!--分类-->
  18. <div v-for="(item, index) in globalClassData" :key="index" class="tab-bar-item" :class="globalClassIndex == index ? 'active' : ''" :data-current="index" @tap.stop="globalSwitchClass(index,item)">
  19. <text style="text-align: center;">{{ item.name || "" }}</text>
  20. </div>
  21. <view style="height: 120upx"></view>
  22. </scroll-view>
  23. <scroll-view scroll-y class="right-box" :scroll-top="globalScrollTopPlace" @scroll="globalGetScroll"
  24. :scroll-into-view="scroll_into_view" scroll-with-animation="true" lower-threshold="100" @scrolltolower="globalScrollBottom">
  25. <!--花材列表-->
  26. <block v-if="!$util.isEmpty(globalItemData)">
  27. <view class="item_list_bx selectAll">
  28. <view class="item_list_title"></view>
  29. <view v-if="!$util.isEmpty(globalItemData)">
  30. <template v-for="(productItem, productIndex) in globalItemData">
  31. <view style="height: 175upx" :key="productIndex">
  32. <Commondity
  33. :globalCheckStock="true"
  34. :selectJobType="selectJobType"
  35. :info="productItem"
  36. @showAddModelFn="showAddModelFn"
  37. @replaceItemFn="replaceItemFn"
  38. @goToSpecialVariety="goToSpecialVariety"
  39. @delProduct="delProduct"
  40. ></Commondity>
  41. </view>
  42. </template>
  43. </view>
  44. <view v-else>
  45. <view style="height:260upx;text-align:center;color:#CCCCCC;position: relative;">
  46. <view style="position: absolute;margin:auto;top:130upx;left:0;right:0;bottom:0;">暂无花材</view>
  47. </view>
  48. </view>
  49. </view>
  50. </block>
  51. <block v-else>
  52. <app-wrapper-empty title="加载中" :is-empty="$util.isEmpty(globalClassItemList)" />
  53. </block>
  54. </scroll-view>
  55. </view>
  56. <modal-module :show="isAddModel" @cancel="addItemModelHidden" @click="confirmAddItemModel" :title="customData.name" color="#333" :size="32" padding="30rpx 30rpx" >
  57. <template slot="customContent">
  58. <view class="select-cmd_bx" v-if="customData">
  59. <view class="kc">
  60. <text class="unit_price">库存 {{ parseFloat(customData.stock) }}</text>
  61. <text class="unit_price"> ¥{{ parseFloat(customData.price) }}</text>
  62. <text>{{customData.ratio}}{{customData.smallUnit}}/{{customData.bigUnit}}</text>
  63. </view>
  64. <view class="num_bx">
  65. <input style="width: 280upx" v-model="customData.userPrice" @focus="customData.userPrice = null"
  66. :disabled="false" type="digit" placeholder="单价" />
  67. <text style="font-size:35upx;font-weight:bold;color:#666666;">元</text>
  68. </view>
  69. <view class="num_bx">
  70. <!-- #ifdef APP-PLUS -->
  71. <input style="width: 280upx" v-model="customData.bigCount" v-if="globalUnitType == 0" type="number" />
  72. <text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 0">{{customData.bigUnit}}</text>
  73. <input style="width: 280upx" v-model="customData.smallCount" v-if="globalUnitType == 1" type="number" />
  74. <text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 1">{{customData.smallUnit}}</text>
  75. <!-- #endif -->
  76. <!-- #ifdef MP-WEIXIN -->
  77. <input style="width: 280upx" v-model="customData.bigCount" v-if="globalUnitType == 0" :focus="isAddInputFocus" type="number" />
  78. <text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 0">{{customData.bigUnit}}</text>
  79. <input style="width: 280upx" v-model="customData.smallCount" v-if="globalUnitType == 1" :focus="isAddInputFocus" type="number" />
  80. <text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 1">{{customData.smallUnit}}</text>
  81. <!-- #endif -->
  82. <image @click="switchGlobalUnitType" :src="`${constant.imgUrl}/icon/switch/switch128.png`"
  83. style="width:86upx;height:86upx;position:absolute;top:300upx;right:40upx;" mode="widthFix"></image>
  84. <button class="admin-button-com mini-btn" @click="customData.userPrice=0.01;customData.bigCount=1" style="position:absolute;top:200upx;right:33upx;">赠送</button>
  85. </view>
  86. </view>
  87. </template>
  88. </modal-module>
  89. <FooterCart :price="allPrice" :count="allCount" @confirm="confirmToSave" ></FooterCart>
  90. <uni-popup ref="globalClassImgRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
  91. <view style="display:flex;padding:20upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
  92. <view v-for="(item, index) in globalClassData" :key="index" @tap.stop="globalChangeClass(index,item)" style="margin-bottom:20upx;margin-left:3upx;">
  93. <image :src="item.cover" style="width:120upx;height:120upx;border-radius:10upx;"></image>
  94. <view style="margin-top:5upx;overflow: hidden;white-space: nowrap;width:120upx;text-align:center;">{{item.name}}</view>
  95. </view>
  96. </view>
  97. </uni-popup>
  98. </view>
  99. </view>
  100. </template>
  101. <script>
  102. import AppSearchModule from "@/components/module/app-search";
  103. import AppTabs from "@/components/plugin/tabs";
  104. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  105. import Commondity from "@/components/module/app-commodity2";
  106. import FooterCart from "@/components/module/app-footer-cart";
  107. import ModalModule from "@/components/plugin/modal";
  108. import { COMMODITY_TYPE } from "@/utils/declare";
  109. import productMins from "@/mixins/product2";
  110. import { getClassRemind,hasClassRemind,getMenu } from "@/api/item-class";
  111. import { delStatusUpdate } from '@/api/product';
  112. import { mapGetters } from "vuex";
  113. export default {
  114. name: "index",
  115. components: {
  116. AppTabs,
  117. AppSearchModule,
  118. AppWrapperEmpty,
  119. Commondity,
  120. ModalModule,
  121. FooterCart,
  122. },
  123. mixins: [productMins],
  124. data() {
  125. return {
  126. COMMODITY_TYPE,
  127. isSmallCount:false,
  128. globalCheckStock:true,
  129. autoLoad: false,
  130. xjData:{},
  131. xjDataInfo:{},
  132. };
  133. },
  134. computed: {
  135. ...mapGetters(["getLoginInfo"]),
  136. },
  137. onShow() {
  138. //小菊等多颜色
  139. if(this.xjData.hasUpdate == 1){
  140. this.customData = this.xjDataInfo
  141. if(this.xjData.cancel == 1){
  142. this.customData.bigCount = 0
  143. this.customData.smallCount = 0
  144. this.replaceItemFn(this.customData,1)
  145. }else{
  146. this.customData.bigCount = this.xjData.stock
  147. this.customData.smallCount = 0
  148. this.customData.bigPrice = this.xjData.price
  149. this.customData.price = this.xjData.price
  150. this.customData.itemPrice = this.xjData.price
  151. this.customData.userPrice = this.xjData.price
  152. this.confirmAddItemModel(this.customData)
  153. }
  154. }
  155. this.xjData = {}
  156. },
  157. onLoad () {
  158. let that = this
  159. if(this.option.customName){
  160. uni.setNavigationBarTitle({ title: this.option.customName })
  161. }
  162. if (this.option.customId){
  163. this.selectJobId = this.option.customId
  164. this.globalCustomId = this.option.customId
  165. }
  166. let book = this.option.book ? this.option.book : 0
  167. if(book == 0){
  168. this.globalRequestType = 'kd'
  169. this.initData()
  170. }else{
  171. this.globalCheckStock = false
  172. this.globalRequestType = 'book'
  173. this.initData()
  174. }
  175. },
  176. methods: {
  177. delProduct(info){
  178. let that = this
  179. that.$util.confirmModal({content:'确认删除?'},() => {
  180. delStatusUpdate({id:info.id,delStatus:1}).then(res=>{
  181. if(res.code == 1){
  182. that.$msg('删除成功')
  183. }
  184. })
  185. })
  186. },
  187. //小菊多颜色选择页
  188. goToSpecialVariety(info){
  189. this.xjDataInfo = info
  190. if(info.stock <= 0){
  191. uni.showToast({title:"没有库存",icon:"none"})
  192. }else{
  193. let userPrice = info.userPrice ? parseFloat(info.userPrice) : 0
  194. let price = info.price ? parseFloat(info.price) : 0
  195. this.$util.pageTo({url: "/admin/item/xj?stock="+info.stock+"&price="+price+"&customId="+this.option.customId+"&userPrice="+userPrice+"&productId="+info.id+"&ptItemId="+info.itemId})
  196. }
  197. },
  198. selectFlowerNumFn(){
  199. this.$refs.globalClassImgRef.open('top')
  200. },
  201. confirmToSave() {
  202. if(this.$util.isEmpty(this.selectList)){
  203. this.$msg('请选择花材')
  204. return false
  205. }
  206. if (this.$util.isEmpty(this.option.customId)){
  207. this.$msg("请选择客户")
  208. return
  209. }
  210. let customName = this.option.customName ? this.option.customName : '';
  211. let orderId = this.option.orderId ? this.option.orderId : 0
  212. let book = this.option.book ? this.option.book : 0
  213. this.$util.pageTo({ url: '/admin/billing/affirm',type:2,query: {customId:this.option.customId,customName:customName,orderId:orderId,book:book}})
  214. }
  215. }
  216. };
  217. </script>
  218. <style lang="scss" scoped>
  219. .billing_box_bg {
  220. background: white;
  221. height: 100%;
  222. display: flex;
  223. flex-direction: column;
  224. .input-wrap {
  225. display: flex;
  226. padding: 22upx 20upx 22upx 13upx;
  227. .search-bar {
  228. flex: 1;
  229. }
  230. }
  231. .scroll-middle_bx {
  232. flex: 1;
  233. display: flex;
  234. width: 100%;
  235. height: 100%;
  236. overflow: hidden;
  237. }
  238. .tab-view {
  239. position: relative;
  240. height: calc(100vh - 140upx);
  241. width: 170upx;
  242. flex-shrink: 0;
  243. background-color: #f0f2f6;
  244. .tab-bar-item {
  245. position: relative;
  246. width: 170upx;
  247. height: 90upx;
  248. box-sizing: border-box;
  249. display: flex;
  250. align-items: center;
  251. justify-content: center;
  252. font-size: 26upx;
  253. color: #444;
  254. font-weight: 400;
  255. .tag {
  256. display: flex;
  257. padding: 0 20upx;
  258. align-items: center;
  259. position: absolute;
  260. right: 0;
  261. top: 0;
  262. height: 32upx;
  263. background: #ff2842;
  264. border-radius: 16upx;
  265. color: #fff;
  266. font-size: 20upx;
  267. }
  268. &:last-child{
  269. margin-bottom: 110upx;
  270. }
  271. }
  272. .active {
  273. position: relative;
  274. color: $mainColor;
  275. font-size: 26upx;
  276. background: #fff;
  277. }
  278. .active::before {
  279. content: "";
  280. position: absolute;
  281. border-left: 8upx solid $mainColor;
  282. height: 100%;
  283. left: 0;
  284. }
  285. }
  286. .right-box {
  287. height: calc(100vh - 140upx);
  288. flex: 1;
  289. box-sizing: border-box;
  290. }
  291. .item_list_bx {
  292. padding: 40upx 16upx;
  293. //padding: 0 16upx;
  294. &:last-child{
  295. margin-bottom: 70upx;
  296. }
  297. }
  298. .item_list_title {
  299. margin-bottom: 20upx;
  300. font-size: 24upx;
  301. font-weight: 600;
  302. color: #666666;
  303. }
  304. .select-cmd_bx {
  305. & .kc {
  306. color: #999999;
  307. font-size: 28upx;
  308. font-weight: 400;
  309. margin-bottom: 40upx;
  310. text-align: center;
  311. margin-top: 30upx;
  312. .unit_price{
  313. padding-right:25upx;
  314. }
  315. }
  316. & .num_bx {
  317. display: flex;
  318. align-items: center;
  319. margin-bottom: 40upx;
  320. padding-left:110upx;
  321. & > input {
  322. width: 212upx;
  323. height: 80upx;
  324. border: 1upx solid #dddddd;
  325. border-radius: 4upx;
  326. text-align: center;
  327. margin-right: 24upx;
  328. font-size: 40upx;
  329. }
  330. }
  331. }
  332. }
  333. .class-popup-style{
  334. z-index:999999;
  335. }
  336. </style>