commodityDetails.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <view>
  3. <view style="width: 100%;height: 750rpx;">
  4. <image :src="form.filesList[0].url" mode="aspectFit" style="width: 100%;height: 750rpx;"
  5. @click="previewImage()" />
  6. </view>
  7. <view style="background-color: #fff;padding: 43rpx 65rpx;margin-bottom: 20rpx;">
  8. <view style="display: flex;justify-content: space-between;">
  9. <view style="display: flex;color: #E75F37;font-size: 40rpx;align-items: flex-end;">
  10. <view style="font-size: 26rpx;height: 40rpx;">
  11. </view>
  12. <view style="font-size: 40rpx;">
  13. {{ checkStatus == '通过' ? form.mallPrice|| 0 :'***'}}
  14. </view>
  15. </view>
  16. <view style="display: flex;align-items: center;">
  17. <view style="display: flex;margin-right: 10rpx;">
  18. <image v-if="Number(inventoryDataForm.storeInventory)" src="/static/images/tabBar/11.png"
  19. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  20. <image v-if="Number(inventoryDataForm.storeInventory)==0" src="/static/images/tabBar/14.png"
  21. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  22. <view style="font-size: 24rpx;color: #C4C4C4;margin-left: 10rpx;">
  23. 库存:{{ inventoryDataForm.storeInventory ? Number(inventoryDataForm.storeInventory) > 10 ? '充足' : inventoryDataForm.storeInventory : '' }}
  24. </view>
  25. </view>
  26. <view style="display: flex;align-items: center;">
  27. <image v-if="Number(inventoryDataForm.storeInventoryShare)" src="/static/images/tabBar/12.png"
  28. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  29. <image v-if="Number(inventoryDataForm.storeInventoryShare)==0"
  30. src="/static/images/tabBar/15.png" mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  31. <view style="font-size: 24rpx;color: #C4C4C4;margin-left: 10rpx;">
  32. 库存:{{ inventoryDataForm.storeInventoryShare ? Number(inventoryDataForm.storeInventoryShare) > 10 ? '充足' : inventoryDataForm.storeInventoryShare : '' }}
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <view style="margin-top: 38rpx;">
  38. <u--text :text="form.cname" size="26rpx" color='#797979' lines="2"></u--text>
  39. </view>
  40. <view style="display: flex;justify-content: space-between;margin-top: 8rpx;align-items: center;">
  41. <view style="font-size: 24rpx;color: #C4C4C4;">
  42. 库存:{{ form.inventory ? Number(form.inventory) > 10 ? '充足' : form.inventory : '' }}
  43. </view>
  44. <u-number-box v-model="form.goodsNum" :min="1" :max="form.inventory" buttonSize="53rpx" color="#414141"
  45. bgColor="#fff" iconStyle="color:#A4A4A4"></u-number-box>
  46. </view>
  47. <view style="display: flex;;margin-top: 8rpx;align-items:center;" v-for="(item, index) in inventoryData"
  48. :key="index">
  49. <view style="display: flex;align-items: center;">
  50. <view style="border-radius: 10rpx;border: 2rpx solid #F6744D;font-size: 26rpx;color: #E75F37;">
  51. {{item.storageName}}
  52. </view>
  53. <view style="font-size: 24rpx;color: #C4C4C4;margin-left: 35rpx;">
  54. 库存:{{Number(item.storeInventory) > 10 ? '充足' : Number(item.storeInventory)}}
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view style="background-color: #fff;padding:62rpx 62rpx 37rpx 62rpx;margin-bottom: 20rpx;">
  60. <view style="font-weight: 400;font-size: 26rpx;color: #797979;" v-show="arrow">
  61. <view style="display: flex;justify-content: space-between;">
  62. <view>
  63. 规格型号:{{ form.specificationAndModel||'-' }}
  64. </view>
  65. <view>
  66. 花纹:{{ form.brandItem || '-' }}
  67. </view>
  68. </view>
  69. <view style="display: flex;justify-content: space-between;margin-top: 52rpx;">
  70. <view>
  71. 产地:{{ form.placeProduction || '-' }}
  72. </view>
  73. <view>
  74. 防爆:{{ form.explosionProof == 1 ? "是" : "否" }}
  75. </view>
  76. </view>
  77. <view style="display: flex;justify-content: space-between;margin-top: 52rpx;">
  78. <view>
  79. 原厂:{{ form.originalFactory == 1 ? '是' : '否' }}
  80. </view>
  81. <view>
  82. 自修复:{{ form.selfRecovery == 1 ? '是' : '否' }}
  83. </view>
  84. </view>
  85. <view style="display: flex;justify-content: space-between;margin-top: 52rpx;">
  86. <view>
  87. 商品描述:{{ form.goodsDescription || '-' }}
  88. </view>
  89. </view>
  90. </view>
  91. <view style="display: flex;justify-content: center;margin-top: 49rpx;" @click="arrow = !arrow">
  92. <image v-if="arrow" src="/static/images/tabBar/10.png" mode="aspectFit"
  93. style="width: 33rpx;height: 26rpx;" />
  94. <image v-if="!arrow" src="/static/images/tabBar/10.png" mode="aspectFit"
  95. style="width: 33rpx;height: 26rpx;transform: rotate(180deg)" />
  96. </view>
  97. </view>
  98. <view style="background-color: #fff;padding:40rpx 62rpx;margin-bottom: 20rpx;">
  99. <view style="font-weight: 400;font-size: 30rpx;color: #F6744D;">
  100. 商品详情
  101. </view>
  102. </view>
  103. <view style="width: 100%;background-color: #fff;">
  104. <view v-html="form.detailsText"></view>
  105. </view>
  106. <view class="text-bottom">
  107. </view>
  108. <view style="width: 100%;position: fixed;bottom: 0;background-color: #fff;border-top:2rpx #F2F2F2 solid;"
  109. class="dynamic-bottom">
  110. <view style="display: flex;justify-content: space-around;align-items: center;">
  111. <view style="width: 71rpx;display: flex;flex-direction: column;align-items: center;"
  112. @click="shoppingCart">
  113. <view class="">
  114. <image src="/static/images/tabBar/16.png" mode="aspectFit"
  115. style="width: 31rpx;height: 28rpx;" />
  116. </view>
  117. <view style="font-size: 24rpx;color: #797979;">
  118. 购物车
  119. </view>
  120. </view>
  121. <view style="width:360rpx;">
  122. <u-button v-if="form.inventory > 0" type="primary" @click="placeAnOrder" text="加入购物车"
  123. color="#E75F37" shape='circle'></u-button>
  124. <u-button v-if="form.inventory == 0" type="primary" @click="soldOut" text="已售罄" color="#c8c9cc"
  125. shape='circle'></u-button>
  126. </view>
  127. </view>
  128. </view>
  129. <!-- 提取去登录 -->
  130. <u-modal :show="adminShow" :showCancelButton="true" content='当前还未登录请先登录!!' @confirm="adminConfirm"
  131. @cancel="adminShow = false"></u-modal>
  132. </view>
  133. </template>
  134. <script>
  135. import {
  136. appDetail,
  137. appDetailNew,
  138. addToCart,
  139. appModifyPrice,
  140. stockDescList,
  141. stockDescListV1,
  142. listShareV1,
  143. isProcurement
  144. } from '@/api/tabBar/homeNew.js'
  145. export default {
  146. data() {
  147. return {
  148. inventoryDataForm: {},
  149. checkboxValue: [],
  150. form: {
  151. shareList: []
  152. },
  153. arrow: true,
  154. dataList: [],
  155. screen: {},
  156. columns: [],
  157. keyName: '',
  158. showWarehouse: false,
  159. dataForm: {
  160. thisLocality: {},
  161. offsite: {}
  162. },
  163. inventoryFalse: true,
  164. inventoryData: [],
  165. // 审核状态
  166. checkStatus: '',
  167. adminShow: false,
  168. }
  169. },
  170. onLoad(onLoad) {
  171. this.checkStatus = uni.getStorageSync('checkStatus');
  172. if (uni.getStorageSync('whether_openShare') == 1) {
  173. appDetailNew(onLoad).then(res => {
  174. this.dataForm = res.data
  175. if (res.data.type == 0) {
  176. this.form = res.data.thisLocality
  177. } else {
  178. this.form = res.data.offsite
  179. }
  180. this.form.goodsNum = Number(this.form.goodsNum)
  181. this.stockDescListfun()
  182. })
  183. } else {
  184. appDetail(onLoad).then(res => {
  185. this.dataForm = res.data
  186. if (res.data.type == 0) {
  187. this.form = res.data.thisLocality
  188. } else {
  189. this.form = res.data.offsite
  190. }
  191. this.form.goodsNum = Number(this.form.goodsNum)
  192. this.stockDescListfun()
  193. })
  194. }
  195. },
  196. methods: {
  197. previewImage() {
  198. uni.previewImage({
  199. current: 0, // 当前显示图片的索引,默认是0
  200. urls: [this.form.filesList[0].url] // 需要预览的图片HTTP链接列表
  201. });
  202. },
  203. // admin确认
  204. adminConfirm() {
  205. uni.clearStorageSync();
  206. uni.redirectTo({
  207. url: '/pages/login/login'
  208. })
  209. },
  210. // 轮播图点击预览
  211. swiperclick(e) {
  212. let arr = this.form.filesList.map(item => {
  213. return item.url
  214. })
  215. uni.previewImage({
  216. count: arr[e],
  217. current: e,
  218. urls: arr
  219. })
  220. },
  221. inventoryFalsefun() {
  222. this.inventoryFalse = !this.inventoryFalse
  223. this.stockDescListfun()
  224. },
  225. // 库存查询
  226. stockDescListfun() {
  227. listShareV1({
  228. code: uni.getStorageSync('whether_openShare') == 1 ? this.form.goodsCode : this.form.code,
  229. id:this.form.id,
  230. whether: 0
  231. }).then(res => {
  232. this.inventoryDataForm = res.data
  233. })
  234. stockDescListV1({
  235. cname: this.form.cname,
  236. whether: 0
  237. }).then(res => {
  238. this.inventoryData = res.data.records
  239. })
  240. },
  241. soldOut() {
  242. uni.showToast({
  243. icon: "none",
  244. title: '商品已售罄',
  245. mask: true
  246. });
  247. },
  248. backToHome() {
  249. uni.$u.route({
  250. url: 'pages/tabBar/home',
  251. type: "switchTab"
  252. })
  253. },
  254. // 加入购物车
  255. placeAnOrder() {
  256. if (uni.getStorageSync('userInfo').tenant_id == '000000') {
  257. this.adminShow = true
  258. return
  259. }
  260. if (this.inventoryDataForm.storeInventory == 0 && this.inventoryDataForm.storeInventoryShare > 0) {
  261. let _this = this
  262. uni.showModal({
  263. title: '提示',
  264. content: '确实要购买次日达商品吗?',
  265. success: function(res) {
  266. if (res.confirm) {
  267. uni.showLoading({
  268. title: '加载中',
  269. mask: true
  270. });
  271. addToCart({
  272. ..._this.form,
  273. whetherIntegral: '0',
  274. detailsText: ''
  275. }).then(res => {
  276. uni.hideLoading();
  277. uni.showToast({
  278. title: "加入购物车成功",
  279. icon: "none",
  280. });
  281. }).catch(err => {
  282. uni.hideLoading();
  283. })
  284. }
  285. }
  286. });
  287. }
  288. if (this.inventoryDataForm.storeInventory > 0) {
  289. uni.showLoading({
  290. title: '加载中',
  291. mask: true
  292. });
  293. addToCart({
  294. ...this.form,
  295. whetherIntegral: '0',
  296. detailsText: ''
  297. }).then(res => {
  298. uni.hideLoading();
  299. uni.showToast({
  300. title: "加入购物车成功",
  301. icon: "none",
  302. });
  303. }).catch(err => {
  304. uni.hideLoading();
  305. })
  306. }
  307. },
  308. filterAll(screen) {
  309. this.screen = screen
  310. switch (screen[1]) {
  311. case "salesCompanyId":
  312. this.columns = [this.form.shareList]
  313. this.keyName = screen[1]
  314. this.showWarehouse = true
  315. break
  316. }
  317. },
  318. confirmWarehouse(e) {
  319. appModifyPrice({
  320. id: e.value[0].id
  321. }).then(res => {
  322. this.form.salesCompanyName = e.value[0].salesCompanyName
  323. this.form.salesCompanyId = e.value[0].salesCompanyId
  324. this.form.mallPrice = res.data.mallPrice
  325. this.form.inventory = res.data.inventory
  326. this.showWarehouse = false
  327. })
  328. },
  329. shoppingCart() {
  330. uni.$u.route({
  331. url: 'pages/tabBar/shoppingCart',
  332. type: "switchTab"
  333. })
  334. }
  335. }
  336. }
  337. </script>
  338. <style lang="scss" scoped>
  339. ::v-deep .u-number-box {
  340. border: 2rpx #E1E1E1 solid;
  341. border-radius: 8rpx;
  342. }
  343. ::v-deep .u-number-box__minus {
  344. border-right: 2rpx #E1E1E1 solid;
  345. }
  346. ::v-deep .u-number-box__plus {
  347. border-left: 2rpx #E1E1E1 solid;
  348. }
  349. ::v-deep .u-button {
  350. height: 60rpx;
  351. }
  352. .dynamic-bottom {
  353. padding: 20rpx 20rpx 0 20rpx;
  354. padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx);
  355. }
  356. .text-bottom {
  357. height: calc(env(safe-area-inset-bottom) + 126rpx);
  358. }
  359. </style>